Skip to content

Commit 9f3d658

Browse files
iii-ikernel-patches-bot
authored andcommitted
getsetsockopt() calls getsockopt() with optlen == 1, but then checks
the resulting int. It is ok on little endian, but not on big endian. Fix by checking char instead. Fixes: 8a027dc ("selftests/bpf: add sockopt test that exercises sk helpers") Signed-off-by: Ilya Leoshkevich <[email protected]> --- v1->v2: Also pass a single byte to log_err. tools/testing/selftests/bpf/prog_tests/sockopt_sk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
1 parent 5249ae6 commit 9f3d658

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/bpf/prog_tests/sockopt_sk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ static int getsetsockopt(void)
4545
goto err;
4646
}
4747

48-
if (*(int *)big_buf != 0x08) {
48+
if (*big_buf != 0x08) {
4949
log_err("Unexpected getsockopt(IP_TOS) optval 0x%x != 0x08",
50-
*(int *)big_buf);
50+
(int)*big_buf);
5151
goto err;
5252
}
5353

0 commit comments

Comments
 (0)