linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/cifs: fix uninitialised variable warnings
@ 2018-10-03 19:51 Garry McNulty
  2018-10-04  8:16 ` Aurélien Aptel
  0 siblings, 1 reply; 3+ messages in thread
From: Garry McNulty @ 2018-10-03 19:51 UTC (permalink / raw)
  To: linux-cifs; +Cc: sfrench, lsahlber, linux-kernel, Garry McNulty

In some error conditions, resp_buftype can be passed uninitialised to
free_rsp_buf(), potentially resulting in a spurious debug message.
If resp_buftype randomly had the value 1 (CIFS_SMALL_BUFFER) then this
would log a debug message.
The rsp pointer is initialised to NULL so there is no other side-effect.

Detected by CoverityScan, CID 1438585 ("Uninitialized scalar variable")
Detected by CoverityScan, CID 1438667 ("Uninitialized scalar variable")
Detected by CoverityScan, CID 1438764 ("Uninitialized scalar variable")

Signed-off-by: Garry McNulty <garrmcnu@gmail.com>
---
 fs/cifs/smb2pdu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index f54d07bda067..65a864b8d09e 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2261,7 +2261,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
 	struct cifs_ses *ses = tcon->ses;
 	struct kvec iov[SMB2_CREATE_IOV_SIZE];
 	struct kvec rsp_iov = {NULL, 0};
-	int resp_buftype;
+	int resp_buftype = CIFS_NO_BUFFER;
 	int rc = 0;
 	int flags = 0;
 
@@ -2547,7 +2547,7 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon,
 	struct cifs_ses *ses = tcon->ses;
 	struct kvec iov[1];
 	struct kvec rsp_iov;
-	int resp_buftype;
+	int resp_buftype = CIFS_NO_BUFFER;
 	int rc = 0;
 
 	cifs_dbg(FYI, "Close\n");
@@ -2699,7 +2699,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
 	struct kvec iov[1];
 	struct kvec rsp_iov;
 	int rc = 0;
-	int resp_buftype;
+	int resp_buftype = CIFS_NO_BUFFER;
 	struct cifs_ses *ses = tcon->ses;
 	int flags = 0;
 
-- 
2.14.4


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

* Re: [PATCH] fs/cifs: fix uninitialised variable warnings
  2018-10-03 19:51 [PATCH] fs/cifs: fix uninitialised variable warnings Garry McNulty
@ 2018-10-04  8:16 ` Aurélien Aptel
  2018-10-06  0:28   ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Aurélien Aptel @ 2018-10-04  8:16 UTC (permalink / raw)
  To: Garry McNulty, linux-cifs; +Cc: sfrench, lsahlber, linux-kernel, Garry McNulty

Reviewed-by: Aurelien Aptel <aaptel@suse.com>
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

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

* Re: [PATCH] fs/cifs: fix uninitialised variable warnings
  2018-10-04  8:16 ` Aurélien Aptel
@ 2018-10-06  0:28   ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2018-10-06  0:28 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: garrmcnu, CIFS, Steve French, Ronnie Sahlberg, LKML

merged into cifs-2.6.git for-next
On Thu, Oct 4, 2018 at 3:16 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)



-- 
Thanks,

Steve

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

end of thread, other threads:[~2018-10-06  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 19:51 [PATCH] fs/cifs: fix uninitialised variable warnings Garry McNulty
2018-10-04  8:16 ` Aurélien Aptel
2018-10-06  0:28   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).