linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy
@ 2021-03-30 19:03 Olga Kornievskaia
  2021-03-31 16:39 ` Chuck Lever III
  0 siblings, 1 reply; 4+ messages in thread
From: Olga Kornievskaia @ 2021-03-30 19:03 UTC (permalink / raw)
  To: bfields, chuck.lever; +Cc: linux-nfs

From: Olga Kornievskaia <kolga@netapp.com>

This patch fixes Dan Carpenter's report that the static checker
found a problem where memcpy() was copying into too small of a buffer.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: e0639dc5805a: "NFSD introduce async copy feature"
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfsd/nfs4proc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index dd9f38d072dd..e13c4c81fb89 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1538,8 +1538,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		if (!nfs4_init_copy_state(nn, copy))
 			goto out_err;
 		refcount_set(&async_copy->refcount, 1);
-		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
-			sizeof(copy->cp_stateid));
+		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid.stid,
+			sizeof(copy->cp_res.cb_stateid));
 		dup_copy_fields(copy, async_copy);
 		async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
 				async_copy, "%s", "copy thread");
-- 
2.18.2


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

* Re: [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy
  2021-03-30 19:03 [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy Olga Kornievskaia
@ 2021-03-31 16:39 ` Chuck Lever III
  2021-03-31 20:54   ` Olga Kornievskaia
  0 siblings, 1 reply; 4+ messages in thread
From: Chuck Lever III @ 2021-03-31 16:39 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: Bruce Fields, Linux NFS Mailing List

Hi Olga-

> On Mar 30, 2021, at 3:03 PM, Olga Kornievskaia <olga.kornievskaia@gmail.com> wrote:
> 
> From: Olga Kornievskaia <kolga@netapp.com>
> 
> This patch fixes Dan Carpenter's report that the static checker
> found a problem where memcpy() was copying into too small of a buffer.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: e0639dc5805a: "NFSD introduce async copy feature"
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>

Thanks! Pushed to the for-next topic branch in:

git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git

With a Reviewed-by: from Dai.


> ---
> fs/nfsd/nfs4proc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index dd9f38d072dd..e13c4c81fb89 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1538,8 +1538,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> 		if (!nfs4_init_copy_state(nn, copy))
> 			goto out_err;
> 		refcount_set(&async_copy->refcount, 1);
> -		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
> -			sizeof(copy->cp_stateid));
> +		memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid.stid,
> +			sizeof(copy->cp_res.cb_stateid));
> 		dup_copy_fields(copy, async_copy);
> 		async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
> 				async_copy, "%s", "copy thread");
> -- 
> 2.18.2
> 

--
Chuck Lever




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

* Re: [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy
  2021-03-31 16:39 ` Chuck Lever III
@ 2021-03-31 20:54   ` Olga Kornievskaia
  2021-04-01 13:35     ` Chuck Lever III
  0 siblings, 1 reply; 4+ messages in thread
From: Olga Kornievskaia @ 2021-03-31 20:54 UTC (permalink / raw)
  To: Chuck Lever III; +Cc: Bruce Fields, Linux NFS Mailing List

On Wed, Mar 31, 2021 at 12:39 PM Chuck Lever III <chuck.lever@oracle.com> wrote:
>
> Hi Olga-
>
> > On Mar 30, 2021, at 3:03 PM, Olga Kornievskaia <olga.kornievskaia@gmail.com> wrote:
> >
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > This patch fixes Dan Carpenter's report that the static checker
> > found a problem where memcpy() was copying into too small of a buffer.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Fixes: e0639dc5805a: "NFSD introduce async copy feature"
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
>
> Thanks! Pushed to the for-next topic branch in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
>
> With a Reviewed-by: from Dai.

Thank you Chuck. It was pointed out that I messed up the "Fixes" line.
Do you want me to send another or can you fix it locally?

>
>
> > ---
> > fs/nfsd/nfs4proc.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > index dd9f38d072dd..e13c4c81fb89 100644
> > --- a/fs/nfsd/nfs4proc.c
> > +++ b/fs/nfsd/nfs4proc.c
> > @@ -1538,8 +1538,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> >               if (!nfs4_init_copy_state(nn, copy))
> >                       goto out_err;
> >               refcount_set(&async_copy->refcount, 1);
> > -             memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
> > -                     sizeof(copy->cp_stateid));
> > +             memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid.stid,
> > +                     sizeof(copy->cp_res.cb_stateid));
> >               dup_copy_fields(copy, async_copy);
> >               async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
> >                               async_copy, "%s", "copy thread");
> > --
> > 2.18.2
> >
>
> --
> Chuck Lever
>
>
>

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

* Re: [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy
  2021-03-31 20:54   ` Olga Kornievskaia
@ 2021-04-01 13:35     ` Chuck Lever III
  0 siblings, 0 replies; 4+ messages in thread
From: Chuck Lever III @ 2021-04-01 13:35 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: Bruce Fields, Linux NFS Mailing List



> On Mar 31, 2021, at 4:54 PM, Olga Kornievskaia <olga.kornievskaia@gmail.com> wrote:
> 
> On Wed, Mar 31, 2021 at 12:39 PM Chuck Lever III <chuck.lever@oracle.com> wrote:
>> 
>> Hi Olga-
>> 
>>> On Mar 30, 2021, at 3:03 PM, Olga Kornievskaia <olga.kornievskaia@gmail.com> wrote:
>>> 
>>> From: Olga Kornievskaia <kolga@netapp.com>
>>> 
>>> This patch fixes Dan Carpenter's report that the static checker
>>> found a problem where memcpy() was copying into too small of a buffer.
>>> 
>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> Fixes: e0639dc5805a: "NFSD introduce async copy feature"
>>> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
>> 
>> Thanks! Pushed to the for-next topic branch in:
>> 
>> git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
>> 
>> With a Reviewed-by: from Dai.
> 
> Thank you Chuck. It was pointed out that I messed up the "Fixes" line.

Interesting that checkpatch.pl did not catch this.


> Do you want me to send another or can you fix it locally?

I'll take care of it. The tag change is entirely mechanical.


>>> ---
>>> fs/nfsd/nfs4proc.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>> 
>>> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
>>> index dd9f38d072dd..e13c4c81fb89 100644
>>> --- a/fs/nfsd/nfs4proc.c
>>> +++ b/fs/nfsd/nfs4proc.c
>>> @@ -1538,8 +1538,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>>>              if (!nfs4_init_copy_state(nn, copy))
>>>                      goto out_err;
>>>              refcount_set(&async_copy->refcount, 1);
>>> -             memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid,
>>> -                     sizeof(copy->cp_stateid));
>>> +             memcpy(&copy->cp_res.cb_stateid, &copy->cp_stateid.stid,
>>> +                     sizeof(copy->cp_res.cb_stateid));
>>>              dup_copy_fields(copy, async_copy);
>>>              async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
>>>                              async_copy, "%s", "copy thread");
>>> --
>>> 2.18.2
>>> 
>> 
>> --
>> Chuck Lever

--
Chuck Lever




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

end of thread, other threads:[~2021-04-01 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 19:03 [PATCH 1/1] NFSv4.2: fix copy stateid copying for the async copy Olga Kornievskaia
2021-03-31 16:39 ` Chuck Lever III
2021-03-31 20:54   ` Olga Kornievskaia
2021-04-01 13:35     ` Chuck Lever III

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