diff mbox series

AW: [PATCH] net: sunrpc: Fix 'snprintf' return value check in 'do_xprt_debugfs'

Message ID b97379d3bf59487d8d0ca3bbf14ad0df@bfs.de
State Not Applicable
Delegated to: David Miller
Headers show
Series AW: [PATCH] net: sunrpc: Fix 'snprintf' return value check in 'do_xprt_debugfs' | expand

Commit Message

Walter Harms Oct. 15, 2020, 3:04 p.m. UTC
if  xprt->debugfs->d_name.name can be what ever long
it is more clever to use kasprintf()
the some for link (no idea how many xprt als possible)

diff mbox series


diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index fd9bca2..56029e3 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -128,13 +128,13 @@  static int do_xprt_debugfs(struct rpc_clnt *clnt, struct rpc_xprt *xprt, void *n
                return 0;
        len = snprintf(name, sizeof(name), "../../rpc_xprt/%s",
-       if (len > sizeof(name))
+       if (len >= sizeof(name))
                return -1;
        if (*nump == 0)
                strcpy(link, "xprt");
        else {
                len = snprintf(link, sizeof(link), "xprt%d", *nump);
-               if (len > sizeof(link))
+               if (len >= sizeof(link))
                        return -1;
        debugfs_create_symlink(link, clnt->cl_debugfs, name);