nfsd: fix using the correct variable for sizeof()
authorJakob Koschel <jakobkoschel@gmail.com>
Sat, 19 Mar 2022 20:27:04 +0000 (21:27 +0100)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 20 Mar 2022 16:49:38 +0000 (12:49 -0400)
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 6d1b5bb..2c05692 100644 (file)
@@ -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);