]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Fix endianness issue in test_sockopt_sk
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 15 Sep 2020 11:39:28 +0000 (13:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:07:40 +0000 (10:07 +0100)
commit98d66a3bb9c019f8101e5e6856730cd76aa7a59e
tree99f6b9f19c0c5976012af42b047135c964472a69
parentf130c8a0eeac9c62586c5aeecef2a8b8bc2bee4a
selftests/bpf: Fix endianness issue in test_sockopt_sk

[ Upstream commit fec47bbc10b243690f5d0ee484a0bbdee273e71b ]

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: 8a027dc0d8f5 ("selftests/bpf: add sockopt test that exercises sk helpers")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200915113928.3768496-1-iii@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/prog_tests/sockopt_sk.c