diff mbox

cifs: remove redundant check for null string pointer

Message ID 1453739154-23796-1-git-send-email-colin.king@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Colin King Jan. 25, 2016, 4:25 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

server_RFC1001_name is declared as a RFC1001_NAME_LEN_WITH_NULL sized
char array in struct TCP_Server_Info so the null pointer check on
server_RFC1001_name is redundant and can be removed.  Detected with
smatch:

fs/cifs/connect.c:2982 ip_rfc1001_connect() warn: this array is probably
  non-NULL. 'server->server_RFC1001_name'

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/cifs/connect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Steve French Feb. 11, 2016, 12:15 a.m. UTC | #1
merged into cifs-2.6.git for-next

On Mon, Jan 25, 2016 at 10:25 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> server_RFC1001_name is declared as a RFC1001_NAME_LEN_WITH_NULL sized
> char array in struct TCP_Server_Info so the null pointer check on
> server_RFC1001_name is redundant and can be removed.  Detected with
> smatch:
>
> fs/cifs/connect.c:2982 ip_rfc1001_connect() warn: this array is probably
>   non-NULL. 'server->server_RFC1001_name'
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/cifs/connect.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 4fbd92d..a763cd3 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2999,8 +2999,7 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)
>         if (ses_init_buf) {
>                 ses_init_buf->trailer.session_req.called_len = 32;
>
> -               if (server->server_RFC1001_name &&
> -                   server->server_RFC1001_name[0] != 0)
> +               if (server->server_RFC1001_name[0] != 0)
>                         rfc1002mangle(ses_init_buf->trailer.
>                                       session_req.called_name,
>                                       server->server_RFC1001_name,
> --
> 2.7.0.rc3
>
> --
> 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
diff mbox

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4fbd92d..a763cd3 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2999,8 +2999,7 @@  ip_rfc1001_connect(struct TCP_Server_Info *server)
 	if (ses_init_buf) {
 		ses_init_buf->trailer.session_req.called_len = 32;
 
-		if (server->server_RFC1001_name &&
-		    server->server_RFC1001_name[0] != 0)
+		if (server->server_RFC1001_name[0] != 0)
 			rfc1002mangle(ses_init_buf->trailer.
 				      session_req.called_name,
 				      server->server_RFC1001_name,