From: Jakob Koschel Date: Sat, 19 Mar 2022 20:27:04 +0000 (+0100) Subject: nfsd: fix using the correct variable for sizeof() X-Git-Tag: v5.18-rc1~174^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fc5f5346592cdc91689455d83885b0af65d71b8;p=thirdparty%2Fkernel%2Flinux.git nfsd: fix using the correct variable for sizeof() 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 Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 6d1b5bb051c56..2c05692a9abf1 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);