]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nfsd: fix using the correct variable for sizeof()
authorJakob Koschel <jakobkoschel@gmail.com>
Sat, 19 Mar 2022 20:27:04 +0000 (21:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:01 +0000 (16:19 +0200)
[ Upstream commit 4fc5f5346592cdc91689455d83885b0af65d71b8 ]

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>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4layouts.c

index 2673019d30ecd647cf1a53c130c3cfce135df405..7018d209b784a5e0cbaa687d85a228b7b0965950 100644 (file)
@@ -421,7 +421,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);