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]
Date:   Thu, 28 Sep 2023 23:37:42 +0530
From:   Deepak R Varma <drv@...lo.com>
To:     Bob Peterson <rpeterso@...hat.com>,
        Andreas Gruenbacher <agruenba@...hat.com>,
        gfs2@...ts.linux.dev, linux-kernel@...r.kernel.org
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        Dan Carpenter <error27@...il.com>,
        Deepak R Varma <drv@...lo.com>
Subject: [PATCH] gfs2: fix 'passing zero to ERR_PTR()' warning

Resolve the following Smatch static checker warning:
	fs/gfs2/acl.c:54 __gfs2_get_acl() warn: passing zero to 'ERR_PTR'

by returning NULL when an extended attribute length is zero, instead of
passing on zero to the ERR_PTR().

Signed-off-by: Deepak R Varma <drv@...lo.com>
---
Please note: Patch is build tested only.


 fs/gfs2/acl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 443640e6fb9c..818d67f10dcf 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -50,8 +50,11 @@ static struct posix_acl *__gfs2_get_acl(struct inode *inode, int type)

 	name = gfs2_acl_name(type);
 	len = gfs2_xattr_acl_get(ip, name, &data);
-	if (len <= 0)
+	if (len == 0)
+		return NULL;
+	if (len < 0)
 		return ERR_PTR(len);
+
 	acl = posix_acl_from_xattr(&init_user_ns, data, len);
 	kfree(data);
 	return acl;
--
2.39.2



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ