Skip to content

Commit 4d9beec

Browse files
committed
smb3: add additional null check in SMB2_ioctl
Although unlikely for it to be possible for rsp to be null here, the check is safer to add, and quiets a Coverity warning. Addresses-Coverity: 1443909 ("Explicit Null dereference") Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0e62904 commit 4d9beec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/cifs/smb2pdu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,6 +3162,16 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
31623162
if ((plen == NULL) || (out_data == NULL))
31633163
goto ioctl_exit;
31643164

3165+
/*
3166+
* Although unlikely to be possible for rsp to be null and rc not set,
3167+
* adding check below is slightly safer long term (and quiets Coverity
3168+
* warning)
3169+
*/
3170+
if (rsp == NULL) {
3171+
rc = -EIO;
3172+
goto ioctl_exit;
3173+
}
3174+
31653175
*plen = le32_to_cpu(rsp->OutputCount);
31663176

31673177
/* We check for obvious errors in the output buffer length and offset */

0 commit comments

Comments
 (0)