diff mbox series

[2/2] SUNRPC: Use kmemdup_nul() in rpc_parse_scope_id()

Message ID 20200202225708.995271-2-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series [1/2] NFS: Replace various occurrences of kstrndup() with kmemdup_nul() | expand

Commit Message

Trond Myklebust Feb. 2, 2020, 10:57 p.m. UTC
Using kmemdup_nul() is more efficient when the length is known.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index d024af4be85e..8b4d72b1a066 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -175,7 +175,7 @@  static int rpc_parse_scope_id(struct net *net, const char *buf,
 		return 0;
 
 	len = (buf + buflen) - delim - 1;
-	p = kstrndup(delim + 1, len, GFP_KERNEL);
+	p = kmemdup_nul(delim + 1, len, GFP_KERNEL);
 	if (p) {
 		u32 scope_id = 0;
 		struct net_device *dev;