Skip to content

Commit

Permalink
SUNRPC: Fix up open coded kmemdup_nul()
Browse files Browse the repository at this point in the history
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
  • Loading branch information
Trond Myklebust committed Dec 2, 2020
1 parent 9a70163 commit 4aceaae
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/sunrpc/xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1942,10 +1942,8 @@ ssize_t xdr_stream_decode_string_dup(struct xdr_stream *xdr, char **str,

ret = xdr_stream_decode_opaque_inline(xdr, &p, maxlen);
if (ret > 0) {
char *s = kmalloc(ret + 1, gfp_flags);
char *s = kmemdup_nul(p, ret, gfp_flags);
if (s != NULL) {
memcpy(s, p, ret);
s[ret] = '\0';
*str = s;
return strlen(s);
}
Expand Down

0 comments on commit 4aceaae

Please sign in to comment.