[PATCH] GFS2: Return -ENOMEM only if kmalloc fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The error variable should be assigned the value of -ENOMEM
after the NULL check and not before.

Signed-off-by: Emil Goode <emilgoode@xxxxxxxxx>
---
 fs/gfs2/acl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 230eb0f..90f6328 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -174,8 +174,8 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr)
 
 	len = posix_acl_to_xattr(acl, NULL, 0);
 	data = kmalloc(len, GFP_NOFS);
-	error = -ENOMEM;
 	if (data == NULL)
+		error = -ENOMEM;
 		goto out;
 	posix_acl_to_xattr(acl, data, len);
 	error = gfs2_xattr_acl_chmod(ip, attr, data);
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux