]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfs: use memcpy_and_pad in decode_fh
authorThorsten Blum <thorsten.blum@linux.dev>
Sun, 5 Apr 2026 10:32:14 +0000 (12:32 +0200)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 22 Apr 2026 12:53:23 +0000 (08:53 -0400)
Use memcpy_and_pad() instead of memcpy() followed by memset() to
simplify decode_fh().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/callback_xdr.c

index 176873f45677e20c5bf80c03b904712bccd8bf37..4382baddc9eed2d8436db3101988511d2527096e 100644 (file)
@@ -96,8 +96,7 @@ static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
        p = xdr_inline_decode(xdr, fh->size);
        if (unlikely(p == NULL))
                return htonl(NFS4ERR_RESOURCE);
-       memcpy(&fh->data[0], p, fh->size);
-       memset(&fh->data[fh->size], 0, sizeof(fh->data) - fh->size);
+       memcpy_and_pad(fh->data, sizeof(fh->data), p, fh->size, 0);
        return 0;
 }