9p: Uninitialized variable in v9fs_writeback_fid()

If v9fs_fid_lookup_with_uid() fails then "fid" is not initialized.

The v9fs_fid_lookup_with_uid() can't return NULL.  If it returns an
error pointer then we can still pass that to clone_fid() and it will
return the error pointer back again.

Fixes: 6636b6dcc3 ("9p: add refcount to p9_fid struct")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
This commit is contained in:
Dan Carpenter 2020-11-30 23:04:12 -08:00 коммит произвёл Dominique Martinet
Родитель 5bfe97d738
Коммит dfd375864a
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -302,8 +302,7 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
struct p9_fid *fid, *ofid;
ofid = v9fs_fid_lookup_with_uid(dentry, GLOBAL_ROOT_UID, 0);
if (ofid && !IS_ERR(ofid))
fid = clone_fid(ofid);
fid = clone_fid(ofid);
if (IS_ERR(fid))
goto error_out;
p9_client_clunk(ofid);