diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2020-11-10 18:56:53 +0300 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2020-12-02 22:05:53 +0300 |
commit | 4aceaaea5eccd32bc40c6c76b262489b2f53ca8d (patch) | |
tree | 5430b474f557316487721b9d6c2783149e39f98a /net/sunrpc/xdr.c | |
parent | 9a7016319e1e7c6348a960931182f5f71b95f24e (diff) | |
download | linux-4aceaaea5eccd32bc40c6c76b262489b2f53ca8d.tar.xz |
SUNRPC: Fix up open coded kmemdup_nul()
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc/xdr.c')
-rw-r--r-- | net/sunrpc/xdr.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 71e03b930b70..b1cda6d85ded 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -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); } |