Skip to content

Commit 357c52f

Browse files
committed
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. Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0de6a47 commit 357c52f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/net/netlink-dumps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ TEST(test_sanity)
5656
ASSERT_EQ(n, sizeof(dump_policies));
5757

5858
n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT);
59-
ASSERT_GE(n, sizeof(struct nlmsghdr));
59+
ASSERT_GE(n, (ssize_t)sizeof(struct nlmsghdr));
6060

6161
n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT);
62-
ASSERT_GE(n, sizeof(struct nlmsghdr));
62+
ASSERT_GE(n, (ssize_t)sizeof(struct nlmsghdr));
6363

6464
close(netlink_sock);
6565
}

0 commit comments

Comments
 (0)