Skip to content

Commit ee2a095

Browse files
lxbszidryomov
authored andcommitted
ceph: initialize pathlen variable in reconnect_caps_cb
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: a33f643 ("ceph: encode inodes' parent/d_name in cap reconnect message") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Xiubo Li <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent e485d02 commit ee2a095

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/ceph/mds_client.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3683,7 +3683,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,
36833683
struct ceph_pagelist *pagelist = recon_state->pagelist;
36843684
struct dentry *dentry;
36853685
char *path;
3686-
int pathlen, err;
3686+
int pathlen = 0, err;
36873687
u64 pathbase;
36883688
u64 snap_follows;
36893689

@@ -3703,7 +3703,6 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap,
37033703
}
37043704
} else {
37053705
path = NULL;
3706-
pathlen = 0;
37073706
pathbase = 0;
37083707
}
37093708

0 commit comments

Comments
 (0)