selftests: net: netlink-dumps: validation checks
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 selftests: net: netlink-dumps: validation checks
The sanity checks are going to get silently cast to unsigned and always pass. Cast the sizeof to signed size.
---
CC: [email protected]
--- tools/testing/selftests/net/netlink-dumps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/netlink-dumps.c +2 -2
@@ -185,10 +185,10 @@ TEST(test_sanity)ASSERT_EQ (n,sizeof (dump_policies)); n =recv (netlink_sock, buf,sizeof (buf),MSG_DONTWAIT ); -ASSERT_GE (n,sizeof (struct nlmsghdr )); +ASSERT_GE (n, (ssize_t )sizeof (struct nlmsghdr )); n =recv (netlink_sock, buf,sizeof (buf),MSG_DONTWAIT ); -ASSERT_GE (n,sizeof (struct nlmsghdr )); +ASSERT_GE (n, (ssize_t )sizeof (struct nlmsghdr ));close (netlink_sock); }
Signature · 1 line
2.47.0
Quoted 4 lines · Jakub Kicinski
The sanity checks are going to get silently cast to unsigned and always pass. Cast the sizeof to signed size.
Signed-off-by Jakub Kicinski <[email protected]>
Ouch. I checked and I couldn't see any other instances of this problem under tools/testing/selftests/net/
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 14 Nov 2024 16:32:48 -0800 you wrote:
The sanity checks are going to get silently cast to unsigned and always pass. Cast the sizeof to signed size.
Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected][...]
Here is the summary with links:
- [net-next] selftests: net: netlink-dumps: validation checks
https://git.kernel.org/netdev/net-next/c/357c52ff860b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html