Skip to content

Commit 43ea703

Browse files
tobluxTrond Myklebust
authored andcommitted
nfs: use memcpy_and_pad in decode_fh
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>
1 parent 8c787b2 commit 43ea703

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/nfs/callback_xdr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
9696
p = xdr_inline_decode(xdr, fh->size);
9797
if (unlikely(p == NULL))
9898
return htonl(NFS4ERR_RESOURCE);
99-
memcpy(&fh->data[0], p, fh->size);
100-
memset(&fh->data[fh->size], 0, sizeof(fh->data) - fh->size);
99+
memcpy_and_pad(fh->data, sizeof(fh->data), p, fh->size, 0);
101100
return 0;
102101
}
103102

0 commit comments

Comments
 (0)