All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful
@ 2022-05-26 14:02 Tom Rix
  2022-05-27 19:32 ` Nick Desaulniers
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2022-05-26 14:02 UTC (permalink / raw)
  To: sfrench, nathan, ndesaulniers, dhowells
  Cc: linux-cifs, samba-technical, linux-kernel, llvm, Tom Rix

clang build fails with
fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  if (rdata->result != 0) {
      ^~~~~~~~~~~~~~~~~~

handle_read_data() returns the number of bytes handled by setting the length variable.
This only happens in the copy_to_iter() branch, it needs to also happen in the
cifs_copy_pages_to_iter() branch.  When cifs_copy_pages_to_iter() is successful,
its parameter data_len is how many bytes were handled, so set length to data_len.

Fixes: 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 3630e132781f..bfad482ec186 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
 				dequeue_mid(mid, rdata->result);
 			return 0;
 		}
-		rdata->got_bytes = pages_len;
+		length = rdata->got_bytes = pages_len;
 
 	} else if (buf_len >= data_offset + data_len) {
 		/* read response payload is in buf */
-- 
2.27.0


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

* Re: [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful
  2022-05-26 14:02 [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful Tom Rix
@ 2022-05-27 19:32 ` Nick Desaulniers
  2022-05-28 23:31   ` Steve French
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2022-05-27 19:32 UTC (permalink / raw)
  To: Steve French
  Cc: nathan, dhowells, linux-cifs, samba-technical, linux-kernel,
	llvm, Tom Rix, sfrench

+ Steve's @microsoft.com email addr.

On Thu, May 26, 2022 at 7:02 AM Tom Rix <trix@redhat.com> wrote:
>
> clang build fails with
> fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>   if (rdata->result != 0) {
>       ^~~~~~~~~~~~~~~~~~
>
> handle_read_data() returns the number of bytes handled by setting the length variable.
> This only happens in the copy_to_iter() branch, it needs to also happen in the
> cifs_copy_pages_to_iter() branch.  When cifs_copy_pages_to_iter() is successful,
> its parameter data_len is how many bytes were handled, so set length to data_len.
>
> Fixes: 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  fs/cifs/smb2ops.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 3630e132781f..bfad482ec186 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
>                                 dequeue_mid(mid, rdata->result);
>                         return 0;
>                 }
> -               rdata->got_bytes = pages_len;
> +               length = rdata->got_bytes = pages_len;
>
>         } else if (buf_len >= data_offset + data_len) {
>                 /* read response payload is in buf */
> --
> 2.27.0
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful
  2022-05-27 19:32 ` Nick Desaulniers
@ 2022-05-28 23:31   ` Steve French
  2022-05-29 12:52     ` Tom Rix
  0 siblings, 1 reply; 4+ messages in thread
From: Steve French @ 2022-05-28 23:31 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Steve French, Nathan Chancellor, David Howells, CIFS,
	samba-technical, LKML, llvm, Tom Rix, Steve French

Presumably this was in Dave Howell's patch set which we took out of
for-next to restructure in some of Al's feedback and some things found
during testing. So nothing to fix in current mainline or for-next ...
right?

On Sat, May 28, 2022 at 3:40 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> + Steve's @microsoft.com email addr.
>
> On Thu, May 26, 2022 at 7:02 AM Tom Rix <trix@redhat.com> wrote:
> >
> > clang build fails with
> > fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >   if (rdata->result != 0) {
> >       ^~~~~~~~~~~~~~~~~~
> >
> > handle_read_data() returns the number of bytes handled by setting the length variable.
> > This only happens in the copy_to_iter() branch, it needs to also happen in the
> > cifs_copy_pages_to_iter() branch.  When cifs_copy_pages_to_iter() is successful,
> > its parameter data_len is how many bytes were handled, so set length to data_len.
> >
> > Fixes: 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")
> > Signed-off-by: Tom Rix <trix@redhat.com>
> > ---
> >  fs/cifs/smb2ops.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> > index 3630e132781f..bfad482ec186 100644
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
> >                                 dequeue_mid(mid, rdata->result);
> >                         return 0;
> >                 }
> > -               rdata->got_bytes = pages_len;
> > +               length = rdata->got_bytes = pages_len;
> >
> >         } else if (buf_len >= data_offset + data_len) {
> >                 /* read response payload is in buf */
> > --
> > 2.27.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,

Steve

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

* Re: [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful
  2022-05-28 23:31   ` Steve French
@ 2022-05-29 12:52     ` Tom Rix
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rix @ 2022-05-29 12:52 UTC (permalink / raw)
  To: Steve French, Nick Desaulniers
  Cc: Steve French, Nathan Chancellor, David Howells, CIFS,
	samba-technical, LKML, llvm, Steve French


On 5/28/22 4:31 PM, Steve French wrote:
> Presumably this was in Dave Howell's patch set which we took out of
> for-next to restructure in some of Al's feedback and some things found
> during testing. So nothing to fix in current mainline or for-next ...
> right?

Yup. Nothing to fix.

So drop this patch.

Tom

>
> On Sat, May 28, 2022 at 3:40 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
>> + Steve's @microsoft.com email addr.
>>
>> On Thu, May 26, 2022 at 7:02 AM Tom Rix <trix@redhat.com> wrote:
>>> clang build fails with
>>> fs/cifs/smb2ops.c:4984:7: error: variable 'length' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>>>    if (rdata->result != 0) {
>>>        ^~~~~~~~~~~~~~~~~~
>>>
>>> handle_read_data() returns the number of bytes handled by setting the length variable.
>>> This only happens in the copy_to_iter() branch, it needs to also happen in the
>>> cifs_copy_pages_to_iter() branch.  When cifs_copy_pages_to_iter() is successful,
>>> its parameter data_len is how many bytes were handled, so set length to data_len.
>>>
>>> Fixes: 67fd8cff2b0f ("cifs: Change the I/O paths to use an iterator rather than a page list")
>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>> ---
>>>   fs/cifs/smb2ops.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
>>> index 3630e132781f..bfad482ec186 100644
>>> --- a/fs/cifs/smb2ops.c
>>> +++ b/fs/cifs/smb2ops.c
>>> @@ -4988,7 +4988,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
>>>                                  dequeue_mid(mid, rdata->result);
>>>                          return 0;
>>>                  }
>>> -               rdata->got_bytes = pages_len;
>>> +               length = rdata->got_bytes = pages_len;
>>>
>>>          } else if (buf_len >= data_offset + data_len) {
>>>                  /* read response payload is in buf */
>>> --
>>> 2.27.0
>>>
>>
>> --
>> Thanks,
>> ~Nick Desaulniers
>
>


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

end of thread, other threads:[~2022-05-29 12:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 14:02 [PATCH] cifs: set length when cifs_copy_pages_to_iter is successful Tom Rix
2022-05-27 19:32 ` Nick Desaulniers
2022-05-28 23:31   ` Steve French
2022-05-29 12:52     ` Tom Rix

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.