linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label
@ 2019-08-29  0:00 Colin King
  2019-08-29  3:59 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-08-29  0:00 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

A previous fix added a jump to after_open which now leaves variable
rc in a uninitialized state. A couple of the cases in the following
switch statement do not set variable rc, hence the error check on rc
at the end of the switch statement is reading a garbage value in rc
for those specific cases. Fix this by initializing rc to zero before
the switch statement.

Fixes: 955a9c5b39379 ("cifs: create a helper to find a writeable handle by path name")
Addresses-Coverity: ("Uninitialized scalar variable")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/cifs/smb2inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 70342bcd89b4..939fc7b2234c 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -116,6 +116,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 	smb2_set_next_command(tcon, &rqst[num_rqst]);
  after_open:
 	num_rqst++;
+	rc = 0;
 
 	/* Operation */
 	switch (command) {
-- 
2.20.1


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

* Re: [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label
  2019-08-29  0:00 [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label Colin King
@ 2019-08-29  3:59 ` Steve French
  2019-08-29  4:09   ` ronnie sahlberg
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2019-08-29  3:59 UTC (permalink / raw)
  To: Colin King, ronnie sahlberg
  Cc: Steve French, CIFS, samba-technical, kernel-janitors, LKML

Merged into cifs-2.6.git for-next

Ronnie,
You ok with merging this as a distinct patch?

On Wed, Aug 28, 2019 at 7:02 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> A previous fix added a jump to after_open which now leaves variable
> rc in a uninitialized state. A couple of the cases in the following
> switch statement do not set variable rc, hence the error check on rc
> at the end of the switch statement is reading a garbage value in rc
> for those specific cases. Fix this by initializing rc to zero before
> the switch statement.
>
> Fixes: 955a9c5b39379 ("cifs: create a helper to find a writeable handle by path name")
> Addresses-Coverity: ("Uninitialized scalar variable")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/cifs/smb2inode.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
> index 70342bcd89b4..939fc7b2234c 100644
> --- a/fs/cifs/smb2inode.c
> +++ b/fs/cifs/smb2inode.c
> @@ -116,6 +116,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
>         smb2_set_next_command(tcon, &rqst[num_rqst]);
>   after_open:
>         num_rqst++;
> +       rc = 0;
>
>         /* Operation */
>         switch (command) {
> --
> 2.20.1
>


-- 
Thanks,

Steve

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

* Re: [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label
  2019-08-29  3:59 ` Steve French
@ 2019-08-29  4:09   ` ronnie sahlberg
  0 siblings, 0 replies; 3+ messages in thread
From: ronnie sahlberg @ 2019-08-29  4:09 UTC (permalink / raw)
  To: Steve French
  Cc: Colin King, Steve French, CIFS, samba-technical, kernel-janitors, LKML

On Thu, Aug 29, 2019 at 2:00 PM Steve French <smfrench@gmail.com> wrote:
>
> Merged into cifs-2.6.git for-next
>
> Ronnie,
> You ok with merging this as a distinct patch?

Sure thing.
Thanks for the fix Colin.


>
> On Wed, Aug 28, 2019 at 7:02 PM Colin King <colin.king@canonical.com> wrote:
> >
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > A previous fix added a jump to after_open which now leaves variable
> > rc in a uninitialized state. A couple of the cases in the following
> > switch statement do not set variable rc, hence the error check on rc
> > at the end of the switch statement is reading a garbage value in rc
> > for those specific cases. Fix this by initializing rc to zero before
> > the switch statement.
> >
> > Fixes: 955a9c5b39379 ("cifs: create a helper to find a writeable handle by path name")
> > Addresses-Coverity: ("Uninitialized scalar variable")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  fs/cifs/smb2inode.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
> > index 70342bcd89b4..939fc7b2234c 100644
> > --- a/fs/cifs/smb2inode.c
> > +++ b/fs/cifs/smb2inode.c
> > @@ -116,6 +116,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
> >         smb2_set_next_command(tcon, &rqst[num_rqst]);
> >   after_open:
> >         num_rqst++;
> > +       rc = 0;
> >
> >         /* Operation */
> >         switch (command) {
> > --
> > 2.20.1
> >
>
>
> --
> Thanks,
>
> Steve

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

end of thread, other threads:[~2019-08-29  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  0:00 [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label Colin King
2019-08-29  3:59 ` Steve French
2019-08-29  4:09   ` ronnie sahlberg

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).