Skip to content

Commit

Permalink
smb3: check for null tcon
Browse files Browse the repository at this point in the history
[ Upstream commit bbdf6cf ]

Although unlikely to be null, it is confusing to use a pointer
before checking for it to be null so move the use down after
null check.

Addresses-Coverity: 1517586 ("Null pointer dereferences  (REVERSE_INULL)")
Reviewed-by: Ronnie Sahlberg <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Steve French authored and gregkh committed Jun 9, 2022
1 parent df6d8b6 commit 9e5b03c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/cifs/smb2ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb,
struct cached_fid **cfid)
{
struct cifs_ses *ses = tcon->ses;
struct TCP_Server_Info *server = ses->server;
struct cifs_ses *ses;
struct TCP_Server_Info *server;
struct cifs_open_parms oparms;
struct smb2_create_rsp *o_rsp = NULL;
struct smb2_query_info_rsp *qi_rsp = NULL;
Expand All @@ -764,6 +764,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
if (tcon->nohandlecache)
return -ENOTSUPP;

ses = tcon->ses;
server = ses->server;

if (cifs_sb->root == NULL)
return -ENOENT;

Expand Down

0 comments on commit 9e5b03c

Please sign in to comment.