]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/nfsd-fix-using-the-correct-variable-for-sizeof.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / nfsd-fix-using-the-correct-variable-for-sizeof.patch
1 From 670891d2427eda6b5a6131a12748841c9c575f15 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Sat, 19 Mar 2022 21:27:04 +0100
4 Subject: nfsd: fix using the correct variable for sizeof()
5
6 From: Jakob Koschel <jakobkoschel@gmail.com>
7
8 [ Upstream commit 4fc5f5346592cdc91689455d83885b0af65d71b8 ]
9
10 While the original code is valid, it is not the obvious choice for the
11 sizeof() call and in preparation to limit the scope of the list iterator
12 variable the sizeof should be changed to the size of the destination.
13
14 Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
15 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
16 ---
17 fs/nfsd/nfs4layouts.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
21 index 2673019d30ecd..7018d209b784a 100644
22 --- a/fs/nfsd/nfs4layouts.c
23 +++ b/fs/nfsd/nfs4layouts.c
24 @@ -421,7 +421,7 @@ nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls)
25 new = kmem_cache_alloc(nfs4_layout_cache, GFP_KERNEL);
26 if (!new)
27 return nfserr_jukebox;
28 - memcpy(&new->lo_seg, seg, sizeof(lp->lo_seg));
29 + memcpy(&new->lo_seg, seg, sizeof(new->lo_seg));
30 new->lo_state = ls;
31
32 spin_lock(&fp->fi_lock);
33 --
34 2.43.0
35