Skip to content

Commit 1db1aa9

Browse files
committed
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 <[email protected]> Acked-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b06d893 commit 1db1aa9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/misc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
264264

265265
/* Uid is not converted */
266266
buffer->Uid = treeCon->ses->Suid;
267-
buffer->Mid = get_next_mid(treeCon->ses->server);
267+
if (treeCon->ses->server)
268+
buffer->Mid = get_next_mid(treeCon->ses->server);
268269
}
269270
if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)
270271
buffer->Flags2 |= SMBFLG2_DFS;

0 commit comments

Comments
 (0)