diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h b/drivers/staging/lustre/lustre/include/lustre_eacl.h index b94f76a3301b..0f8f76c43ee1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_eacl.h +++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h @@ -74,7 +74,7 @@ typedef struct { extern ext_acl_xattr_header * lustre_posix_acl_xattr_2ext(posix_acl_xattr_header *header, int size); extern int -lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, int size, +lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, size_t size, posix_acl_xattr_header **out); extern void lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size); diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c index 2619bfeceb8b..9a69f6b35a0e 100644 --- a/drivers/staging/lustre/lustre/obdclass/acl.c +++ b/drivers/staging/lustre/lustre/obdclass/acl.c @@ -171,17 +171,17 @@ EXPORT_SYMBOL(lustre_posix_acl_xattr_2ext); /* * Filter out the "nobody" entries in the posix ACL. */ -int lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, int size, +int lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, size_t size, posix_acl_xattr_header **out) { int count, i, j, rc = 0; __u32 id; posix_acl_xattr_header *new; - if (unlikely(size < 0)) - return -EINVAL; - else if (!size) + if (!size) return 0; + if (size < sizeof(*new)) + return -EINVAL; OBD_ALLOC(new, size); if (unlikely(new == NULL))