diff options
author | Steve French <stfrench@microsoft.com> | 2021-09-23 18:52:40 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-09-23 21:12:23 -0500 |
commit | 1db1aa98871defd9316d13f59708f2277c4f9232 (patch) | |
tree | 95e0dc39a0f34e4d25883ca6f7ffcb94e9e60f94 | |
parent | b06d893ef2492245d0319b4136edb4c346b687a3 (diff) |
smb3: correct server pointer dereferencing check to be more consistent
Address warning:
fs/smbfs_client/misc.c:273 header_assemble()
warn: variable dereferenced before check 'treeCon->ses->server'
Pointed out by Dan Carpenter via smatch code analysis tool
Although the check is likely unneeded, adding it makes the code
more consistent and easier to read, as the same check is
done elsewhere in the function.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r-- | fs/cifs/misc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index f2916b51652a..bb1185fff8cc 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -264,7 +264,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , /* Uid is not converted */ buffer->Uid = treeCon->ses->Suid; - buffer->Mid = get_next_mid(treeCon->ses->server); + if (treeCon->ses->server) + buffer->Mid = get_next_mid(treeCon->ses->server); } if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) buffer->Flags2 |= SMBFLG2_DFS; |