Skip to contentSkip to conversation

CIFS: remove an unneeded NULL check

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 30, 2015 – May 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: remove an unneeded NULL check

Smatch complains because we dereference "ses->server" without checking some lines earlier inside the call to get_next_mid(ses->server).

	fs/cifs/cifssmb.c:4921 CIFSGetDFSRefer()
	warn: variable dereferenced before check 'ses->server' (see line 4899)

There is only one caller for this function get_dfs_path() and it always passes a non-null "ses->server" pointer so this NULL check can be removed.

fs/cifs/cifssmb.c +1 -1
index 1091aff..f26ffbf 100644
@@ -4918,7 +4918,7 @@ getDFSRetry:
 		strncpy(pSMB->RequestFileName, search_name, name_len);
 	}
 
-	if (ses->server && ses->server->sign)
+	if (ses->server->sign)
 		pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
 
 	pSMB->hdr.Uid = ses->Suid;
Applied
#1 lore raw

merged into cifs-2.6.git

Quoted 29 lines · Dan Carpenter

Smatch complains because we dereference "ses->server" without checking some lines earlier inside the call to get_next_mid(ses->server).

        fs/cifs/cifssmb.c:4921 CIFSGetDFSRefer()
        warn: variable dereferenced before check 'ses->server' (see line 4899)

There is only one caller for this function get_dfs_path() and it always passes a non-null "ses->server" pointer so this NULL check can be removed.

fs/cifs/cifssmb.c +1 -2
index 1091aff..f26ffbf 100644
@@ -4918,7 +4918,7 @@ getDFSRetry:
                strncpy(pSMB->RequestFileName, search_name, name_len);
        }
 
-       if (ses->server && ses->server->sign)
+       if (ses->server->sign)
                pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
 
        pSMB->hdr.Uid = ses->Suid;
--

To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve