[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230925045059.92883-1-suhui@nfschina.com>
Date: Mon, 25 Sep 2023 12:51:00 +0800
From: Su Hui <suhui@...china.com>
To: miklos@...redi.hu, amir73il@...il.com
Cc: Su Hui <suhui@...china.com>, linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] ovl: avoid possible NULL dereference
smatch warn:
fs/overlayfs/copy_up.c:450 ovl_set_origin() warn:
variable dereferenced before check 'fh' (see line 449)
If 'fh' is NULL, passing NULL instead of 'fh->buf'.
Signed-off-by: Su Hui <suhui@...china.com>
---
fs/overlayfs/copy_up.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index d1761ec5866a..086f9176b4d4 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -446,7 +446,7 @@ int ovl_set_origin(struct ovl_fs *ofs, struct dentry *lower,
/*
* Do not fail when upper doesn't support xattrs.
*/
- err = ovl_check_setxattr(ofs, upper, OVL_XATTR_ORIGIN, fh->buf,
+ err = ovl_check_setxattr(ofs, upper, OVL_XATTR_ORIGIN, fh ? fh->buf : NULL,
fh ? fh->fb.len : 0, 0);
kfree(fh);
--
2.30.2
Powered by blists - more mailing lists