lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1335474778-6252-1-git-send-email-emilgoode@gmail.com>
Date:	Thu, 26 Apr 2012 23:12:58 +0200
From:	Emil Goode <emilgoode@...il.com>
To:	swhiteho@...hat.com, cluster-devel@...hat.com
Cc:	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
	Emil Goode <emilgoode@...il.com>
Subject: [PATCH] GFS2: Return -ENOMEM only if kmalloc fails

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

Signed-off-by: Emil Goode <emilgoode@...il.com>
---
 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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ