octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 19 Feb 2021 09:56:32 +0000 (12:56 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 21 Feb 2021 21:29:25 +0000 (13:29 -0800)
This code does not allocate enough memory for the NUL terminator so it
ends up putting it one character beyond the end of the buffer.

Fixes: 8756828a8148 ("octeontx2-af: Add NPA aura and pool contexts to debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c

index 094124b695dcc4203195b06dc44fa25e16c1475d..aa2ca8780b9c7f91047e65f29fb97bef5cca2181 100644 (file)
@@ -473,7 +473,7 @@ static ssize_t rvu_dbg_qsize_write(struct file *filp,
        u16 pcifunc;
        int ret, lf;
 
-       cmd_buf = memdup_user(buffer, count);
+       cmd_buf = memdup_user(buffer, count + 1);
        if (IS_ERR(cmd_buf))
                return -ENOMEM;