kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] 9p: Uninitialized variable in v9fs_writeback_fid()
@ 2020-12-01  7:04 Dan Carpenter
  2020-12-01  7:20 ` Dominique Martinet
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-12-01  7:04 UTC (permalink / raw)
  To: kernel-janitors

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: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/9p/fid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 50118ec72a92..79837f1b1c91 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -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);
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] 9p: Uninitialized variable in v9fs_writeback_fid()
  2020-12-01  7:04 [PATCH 1/2] 9p: Uninitialized variable in v9fs_writeback_fid() Dan Carpenter
@ 2020-12-01  7:20 ` Dominique Martinet
  0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2020-12-01  7:20 UTC (permalink / raw)
  To: kernel-janitors

Dan Carpenter wrote on Mon, Nov 30, 2020:
> 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: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, taken both.

-- 
Dominique

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-01  7:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-01  7:04 [PATCH 1/2] 9p: Uninitialized variable in v9fs_writeback_fid() Dan Carpenter
2020-12-01  7:20 ` Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).