Skip to content

Commit bbdf6cf

Browse files
committed
smb3: check for null tcon
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 <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 93ed91c commit bbdf6cf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

fs/cifs/smb2ops.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
760760
struct cifs_sb_info *cifs_sb,
761761
struct cached_fid **cfid)
762762
{
763-
struct cifs_ses *ses = tcon->ses;
764-
struct TCP_Server_Info *server = ses->server;
763+
struct cifs_ses *ses;
764+
struct TCP_Server_Info *server;
765765
struct cifs_open_parms oparms;
766766
struct smb2_create_rsp *o_rsp = NULL;
767767
struct smb2_query_info_rsp *qi_rsp = NULL;
@@ -780,6 +780,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
780780
is_smb1_server(tcon->ses->server))
781781
return -ENOTSUPP;
782782

783+
ses = tcon->ses;
784+
server = ses->server;
785+
783786
if (cifs_sb->root == NULL)
784787
return -ENOENT;
785788

0 commit comments

Comments
 (0)