diff mbox

[1/4,SMB3] Fix warning on uninitialized buftype

Message ID 1427434082-4299-2-git-send-email-smfrench@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French March 27, 2015, 5:27 a.m. UTC
Pointed out by coverity analyzer.  resp_buftype is
not initialized in one path which can rarely log
a spurious warning (buf is null so there will
not be a problem with freeing data, but if buf_type
were randomly set to wrong value could log a warning)

Reported by Coverity (CID 1269144)

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shirish Pargaonkar March 28, 2015, 2:19 p.m. UTC | #1
Looks correct.

Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>

On Fri, Mar 27, 2015 at 12:27 AM, Steve French <smfrench@gmail.com> wrote:
> Pointed out by coverity analyzer.  resp_buftype is
> not initialized in one path which can rarely log
> a spurious warning (buf is null so there will
> not be a problem with freeing data, but if buf_type
> were randomly set to wrong value could log a warning)
>
> Reported by Coverity (CID 1269144)
>
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 3417340..1b906de 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -2114,7 +2114,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
>         struct kvec iov[2];
>         int rc = 0;
>         int len;
> -       int resp_buftype;
> +       int resp_buftype = CIFS_NO_BUFFER;
>         unsigned char *bufptr;
>         struct TCP_Server_Info *server;
>         struct cifs_ses *ses = tcon->ses;
> --
> 1.9.1
>
> --
> 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
--
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
Sachin Prabhu March 30, 2015, 9:36 a.m. UTC | #2
On Fri, 2015-03-27 at 00:27 -0500, Steve French wrote:
> Pointed out by coverity analyzer.  resp_buftype is
> not initialized in one path which can rarely log
> a spurious warning (buf is null so there will
> not be a problem with freeing data, but if buf_type
> were randomly set to wrong value could log a warning)
> 
> Reported by Coverity (CID 1269144)
> 
> Signed-off-by: Steve French <smfrench@gmail.com>

ACKed-by: Sachin Prabhu <sprabhu@redhat.com>

> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 3417340..1b906de 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -2114,7 +2114,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
>  	struct kvec iov[2];
>  	int rc = 0;
>  	int len;
> -	int resp_buftype;
> +	int resp_buftype = CIFS_NO_BUFFER;
>  	unsigned char *bufptr;
>  	struct TCP_Server_Info *server;
>  	struct cifs_ses *ses = tcon->ses;


--
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
Jeff Layton April 1, 2015, 12:35 a.m. UTC | #3
On Fri, 27 Mar 2015 00:27:59 -0500
Steve French <smfrench@gmail.com> wrote:

> Pointed out by coverity analyzer.  resp_buftype is
> not initialized in one path which can rarely log
> a spurious warning (buf is null so there will
> not be a problem with freeing data, but if buf_type
> were randomly set to wrong value could log a warning)
> 
> Reported by Coverity (CID 1269144)
> 
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 3417340..1b906de 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -2114,7 +2114,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
>  	struct kvec iov[2];
>  	int rc = 0;
>  	int len;
> -	int resp_buftype;
> +	int resp_buftype = CIFS_NO_BUFFER;
>  	unsigned char *bufptr;
>  	struct TCP_Server_Info *server;
>  	struct cifs_ses *ses = tcon->ses;

Reviewed-by: Jeff Layton <jlayton@poochiereds.net>
--
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/smb2pdu.c b/fs/cifs/smb2pdu.c
index 3417340..1b906de 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2114,7 +2114,7 @@  SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
 	struct kvec iov[2];
 	int rc = 0;
 	int len;
-	int resp_buftype;
+	int resp_buftype = CIFS_NO_BUFFER;
 	unsigned char *bufptr;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses = tcon->ses;