staging: lustre: fix handling lustre_posix_acl_xattr_filter result
authorAndrzej Hajda <a.hajda@samsung.com>
Mon, 21 Sep 2015 13:33:37 +0000 (15:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 01:57:00 +0000 (03:57 +0200)
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/xattr.c

index 362a87d0d0d349502464921673dc68e05b421753..dddc1ffc616425bcba9ee2c0caae7b1c9b17cdee 100644 (file)
@@ -175,11 +175,12 @@ int ll_setxattr_common(struct inode *inode, const char *name,
                        }
                        ee_free(ee);
                } else if (rce->rce_ops == RMT_RSETFACL) {
-                       size = lustre_posix_acl_xattr_filter(
+                       rc = lustre_posix_acl_xattr_filter(
                                                (posix_acl_xattr_header *)value,
                                                size, &new_value);
-                       if (unlikely(size < 0))
-                               return size;
+                       if (unlikely(rc < 0))
+                               return rc;
+                       size = rc;
 
                        pv = (const char *)new_value;
                } else