Skip to content

Commit 9ed38fd

Browse files
committed
cifs: fix incorrect check for null pointer in header_assemble
Although very unlikely that the tlink pointer would be null in this case, get_next_mid function can in theory return null (but not an error) so need to check for null (not for IS_ERR, which can not be returned here). Address warning: fs/smbfs_client/connect.c:2392 cifs_match_super() warn: 'tlink' isn't an ERR_PTR Pointed out by Dan Carpenter via smatch code analysis tool CC: [email protected] Reported-by: Dan Carpenter <[email protected]> Acked-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 1db1aa9 commit 9ed38fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/cifs/connect.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,9 +2389,10 @@ cifs_match_super(struct super_block *sb, void *data)
23892389
spin_lock(&cifs_tcp_ses_lock);
23902390
cifs_sb = CIFS_SB(sb);
23912391
tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
2392-
if (IS_ERR(tlink)) {
2392+
if (tlink == NULL) {
2393+
/* can not match superblock if tlink were ever null */
23932394
spin_unlock(&cifs_tcp_ses_lock);
2394-
return rc;
2395+
return 0;
23952396
}
23962397
tcon = tlink_tcon(tlink);
23972398
ses = tcon->ses;

0 commit comments

Comments
 (0)