From: Xiubo Li Date: Tue, 30 Nov 2021 11:20:34 +0000 (+0800) Subject: ceph: initialize pathlen variable in reconnect_caps_cb X-Git-Tag: accepted/tizen/unified/20230118.172025~4185 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7506c76b7ef072df9d42df77fe73deb4b85ec26;p=platform%2Fkernel%2Flinux-rpi.git ceph: initialize pathlen variable in reconnect_caps_cb [ Upstream commit ee2a095d3b24f300a5e11944d208801e928f108c ] The smatch static checker warned about an uninitialized symbol usage in this function, in the case where ceph_mdsc_build_path returns an error. It turns out that that case is harmless, but it just looks sketchy. Initialize the variable at declaration time, and remove the unneeded setting of it later. Fixes: a33f6432b3a6 ("ceph: encode inodes' parent/d_name in cap reconnect message") Reported-by: Dan Carpenter Signed-off-by: Xiubo Li Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index d64413a..e9409c4 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3772,7 +3772,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, struct ceph_pagelist *pagelist = recon_state->pagelist; struct dentry *dentry; char *path; - int pathlen, err; + int pathlen = 0, err; u64 pathbase; u64 snap_follows; @@ -3792,7 +3792,6 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, } } else { path = NULL; - pathlen = 0; pathbase = 0; }