Skip to content

Commit 6c52816

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 <iii@linux.ibm.com> --- tools/testing/selftests/bpf/prog_tests/sockopt_sk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
1 parent c40cc0b commit 6c52816

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ 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",
5050
*(int *)big_buf);
5151
goto err;

0 commit comments

Comments
 (0)