Commit ca780da5 authored by Steve French's avatar Steve French

smb3: add additional null check in SMB311_posix_mkdir

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: 1437501 ("Explicit Null dereference")
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 9e7ffa77
...@@ -2668,7 +2668,18 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, ...@@ -2668,7 +2668,18 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
goto err_free_rsp_buf; goto err_free_rsp_buf;
} }
/*
* Although unlikely to be possible for rsp to be null and rc not set,
* adding check below is slightly safer long term (and quiets Coverity
* warning)
*/
rsp = (struct smb2_create_rsp *)rsp_iov.iov_base; rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
if (rsp == NULL) {
rc = -EIO;
kfree(pc_buf);
goto err_free_req;
}
trace_smb3_posix_mkdir_done(xid, le64_to_cpu(rsp->PersistentFileId), trace_smb3_posix_mkdir_done(xid, le64_to_cpu(rsp->PersistentFileId),
tcon->tid, tcon->tid,
ses->Suid, CREATE_NOT_FILE, ses->Suid, CREATE_NOT_FILE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment