diff mbox series

[net-next] selftests: net: netlink-dumps: validation checks

Message ID 20241115003248.733862-1-kuba@kernel.org
State New
Headers show
Series [net-next] selftests: net: netlink-dumps: validation checks | expand

Commit Message

Jakub Kicinski Nov. 15, 2024, 12:32 a.m. UTC
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 <kuba@kernel.org>
---
CC: linux-kselftest@vger.kernel.org
---
 tools/testing/selftests/net/netlink-dumps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 19, 2024, 3 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 <kuba@kernel.org>
> ---
> CC: linux-kselftest@vger.kernel.org
> 
> [...]

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!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/netlink-dumps.c b/tools/testing/selftests/net/netlink-dumps.c
index 195febbf6a61..07423f256f96 100644
--- a/tools/testing/selftests/net/netlink-dumps.c
+++ b/tools/testing/selftests/net/netlink-dumps.c
@@ -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);
 }