]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netdevsim: Add trailing zero to terminate the string in nsim_nexthop_bucket_activity_...
authorZichen Xie <zichenxie0106@gmail.com>
Tue, 22 Oct 2024 17:19:08 +0000 (12:19 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Nov 2024 15:25:53 +0000 (16:25 +0100)
commitc2150f666c6fc301d5d1643ed0f92251f1a0ff0d
treec21d6f235cd470396c09ca41c2f191d72097a465
parent05df1b1dff8f197f1c275b57ccb2ca33021df552
netdevsim: Add trailing zero to terminate the string in nsim_nexthop_bucket_activity_write()

[ Upstream commit 4ce1f56a1eaced2523329bef800d004e30f2f76c ]

This was found by a static analyzer.
We should not forget the trailing zero after copy_from_user()
if we will further do some string operations, sscanf() in this
case. Adding a trailing zero will ensure that the function
performs properly.

Fixes: c6385c0b67c5 ("netdevsim: Allow reporting activity on nexthop buckets")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20241022171907.8606-1-zichenxie0106@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/netdevsim/fib.c