diff mbox series

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

Message ID 20230508065335.114409-1-xiubli@redhat.com
State New
Headers show
Series ceph: fix the Smatch static checker warning in reconnect_caps_cb() | expand

Commit Message

Xiubo Li May 8, 2023, 6:53 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

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'

Cc: stable@vger.kernel.org
Fixes: aaf67de78807 ("ceph: fix potential use-after-free bug when trimming caps")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/mds_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dan Carpenter May 8, 2023, 7:20 a.m. UTC | #1
On Mon, May 08, 2023 at 02:53:35PM +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> 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'
> 
> Cc: stable@vger.kernel.org
> 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
diff mbox series

Patch

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 36521bd4b78b..d6467fe7e5fa 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -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",