Skip to contentSkip to conversation

ceph: fix the Smatch static checker warning in reconnect_caps_cb()

PATCH In review [email protected] 2 participants 3 messages May 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: fix the Smatch static checker warning in reconnect_caps_cb()

From: Xiubo Li <[email protected]>

Smatch static checker warning:

fs/ceph/mds_client.c:3968 reconnect_caps_cb()
warn: missing error code here? '__get_cap_for_mds()' failed. 'err' = '0'

Fixes aaf67de78807 ("ceph: fix potential use-after-free bug when trimming caps")
---
 fs/ceph/mds_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/mds_client.c +2 -1
index 36521bd4b78b..d6467fe7e5fa 100644
@@ -4296,7 +4296,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
 	struct dentry *dentry;
 	struct ceph_cap *cap;
 	char *path;
-	int pathlen = 0, err = 0;
+	int pathlen = 0, err;
 	u64 pathbase;
 	u64 snap_follows;
 
@@ -4319,6 +4319,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
 	cap = __get_cap_for_mds(ci, mds);
 	if (!cap) {
 		spin_unlock(&ci->i_ceph_lock);
+		err = 0;
 		goto out_err;
 	}
 	dout(" adding %p ino %llx.%llx cap %p %lld %s\n",
Signature · 1 line
2.40.0
#1 lore raw
Quoted 9 lines · On Mon, May 08, 2023 at 02:53:35PM +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Smatch static checker warning:

fs/ceph/mds_client.c:3968 reconnect_caps_cb()
warn: missing error code here? '__get_cap_for_mds()' failed. 'err' = '0'

Fixes aaf67de78807 ("ceph: fix potential use-after-free bug when trimming caps")

Of course, thanks for the patch. But this is not really a bug fix since it doesn't change runtime at all. And definitely no need to CC stable.

regards,
dan carpenter

author
#2 lore raw
Quoted 5 lines · Dan Carpenter
Quoted 4 lines · On Mon, May 08, 2023 at 02:53:35PM +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Smatch static checker warning:

Quoted 7 lines
Quoted 5 lines

fs/ceph/mds_client.c:3968 reconnect_caps_cb()
warn: missing error code here? '__get_cap_for_mds()' failed. 'err' = '0'

Fixes aaf67de78807 ("ceph: fix potential use-after-free bug when trimming caps")

Of course, thanks for the patch. But this is not really a bug fix since it doesn't change runtime at all. And definitely no need to CC stable.

The previous patch Cced the stable, so I just added it here.

If that not necessary I will remove it.

Thanks

- Xiubo

Quoted 3 lines

regards,
dan carpenter