octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
Subsystems (4)
PATCH 1/1 octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
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.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +1 -1
@@ -385,7 +385,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 ;
Signature · 1 line
2.30.0
Jakub Kicinski
maintainerQuoted 5 lines · On Fri, 19 Feb 2021 12:56:32 +0300 Dan Carpenter wrote:
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 <[email protected]>
Fix looks correct, thanks! The interface itself is another matter..
Quoted 24 lines · Dan Carpenter
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 <[email protected]>--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +1
-2@@ -385,7 +385,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 ; --
Quoted 2 lines
2.30.0
Thanks for the fix.
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 8 lines · On Fri, 19 Feb 2021 12:56:32 +0300 you wrote:
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 <[email protected]>--- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net] octeontx2-af: Fix an off by one in rvu_dbg_qsize_write()
https://git.kernel.org/netdev/net/c/3a2eb515d136
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html