All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd: fix using the correct variable for sizeof()
@ 2022-03-19 20:27 Jakob Koschel
  2022-03-20 17:00 ` Chuck Lever III
  0 siblings, 1 reply; 2+ messages in thread
From: Jakob Koschel @ 2022-03-19 20:27 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Jakob Koschel, linux-kernel, linux-nfs, Mike Rapoport,
	Brian Johannesmeyer, Cristiano Giuffrida, Bos, H.J.

While the original code is valid, it is not the obvious choice for the
sizeof() call and in preparation to limit the scope of the list iterator
variable the sizeof should be changed to the size of the destination.

Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
---
 fs/nfsd/nfs4layouts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 6d1b5bb051c5..2c05692a9abf 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -422,7 +422,7 @@ nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls)
 	new = kmem_cache_alloc(nfs4_layout_cache, GFP_KERNEL);
 	if (!new)
 		return nfserr_jukebox;
-	memcpy(&new->lo_seg, seg, sizeof(lp->lo_seg));
+	memcpy(&new->lo_seg, seg, sizeof(new->lo_seg));
 	new->lo_state = ls;
 
 	spin_lock(&fp->fi_lock);

base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
-- 
2.25.1


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

* Re: [PATCH] nfsd: fix using the correct variable for sizeof()
  2022-03-19 20:27 [PATCH] nfsd: fix using the correct variable for sizeof() Jakob Koschel
@ 2022-03-20 17:00 ` Chuck Lever III
  0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever III @ 2022-03-20 17:00 UTC (permalink / raw)
  To: Jakob Koschel
  Cc: linux-kernel, Linux NFS Mailing List, Mike Rapoport,
	Brian Johannesmeyer, Cristiano Giuffrida, Bos, H.J.


> On Mar 19, 2022, at 4:27 PM, Jakob Koschel <jakobkoschel@gmail.com> wrote:
> 
> While the original code is valid, it is not the obvious choice for the
> sizeof() call and in preparation to limit the scope of the list iterator
> variable the sizeof should be changed to the size of the destination.
> 
> Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
> ---
> fs/nfsd/nfs4layouts.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
> index 6d1b5bb051c5..2c05692a9abf 100644
> --- a/fs/nfsd/nfs4layouts.c
> +++ b/fs/nfsd/nfs4layouts.c
> @@ -422,7 +422,7 @@ nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls)
> 	new = kmem_cache_alloc(nfs4_layout_cache, GFP_KERNEL);
> 	if (!new)
> 		return nfserr_jukebox;
> -	memcpy(&new->lo_seg, seg, sizeof(lp->lo_seg));
> +	memcpy(&new->lo_seg, seg, sizeof(new->lo_seg));
> 	new->lo_state = ls;
> 
> 	spin_lock(&fp->fi_lock);
> 
> base-commit: 34e047aa16c0123bbae8e2f6df33e5ecc1f56601
> -- 
> 2.25.1
> 

Thanks, Jakob. Applied to the for-next branch at

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

--
Chuck Lever




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

end of thread, other threads:[~2022-03-20 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 20:27 [PATCH] nfsd: fix using the correct variable for sizeof() Jakob Koschel
2022-03-20 17:00 ` Chuck Lever III

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.