Skip to contentSkip to conversation

selftests: net: netlink-dumps: validation checks

PATCH Applied Jakub Kicinski 3 participants 3 messages Nov 15, 2024 – Nov 19, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 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
index 195febbf6a61..07423f256f96 100644
@@ -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
#2 lore raw
In reply to Jakub Kicinski
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.

---
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