All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] CIFS: remove an unneeded NULL check
@ 2015-04-30 14:30 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-04-30 14:30 UTC (permalink / raw)
  To: Steve French; +Cc: linux-cifs, samba-technical, kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1091aff..f26ffbf 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] CIFS: remove an unneeded NULL check
@ 2015-04-30 14:30 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-04-30 14:30 UTC (permalink / raw)
  To: Steve French; +Cc: linux-cifs, samba-technical, kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1091aff..f26ffbf 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] CIFS: remove an unneeded NULL check
  2015-04-30 14:30 ` Dan Carpenter
@ 2015-05-20 16:36   ` Steve French
  -1 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2015-05-20 16:36 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

merged into cifs-2.6.git

On Thu, Apr 30, 2015 at 9:30 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 1091aff..f26ffbf 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] CIFS: remove an unneeded NULL check
@ 2015-05-20 16:36   ` Steve French
  0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2015-05-20 16:36 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

merged into cifs-2.6.git

On Thu, Apr 30, 2015 at 9:30 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 1091aff..f26ffbf 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-20 16:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 14:30 [patch] CIFS: remove an unneeded NULL check Dan Carpenter
2015-04-30 14:30 ` Dan Carpenter
2015-05-20 16:36 ` Steve French
2015-05-20 16:36   ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.