summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2023-06-06 13:30:47 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-19 16:21:07 +0200
commit54257a763443d2c1af1bf83dc9c5afcf0cfc3a23 (patch)
tree4d4e79153bb94fdec0980df9e62ec1a6648eeae8 /tools
parentda79a0bc36c595dfb95d81ae36d1cd91b4eb55b2 (diff)
downloadlinux-starfive-54257a763443d2c1af1bf83dc9c5afcf0cfc3a23.tar.gz
linux-starfive-54257a763443d2c1af1bf83dc9c5afcf0cfc3a23.tar.bz2
linux-starfive-54257a763443d2c1af1bf83dc9c5afcf0cfc3a23.zip
selftests/bpf: Fix check_mtu using wrong variable type
[ Upstream commit 095641817e1bf6aa2560e025e47575188ee3edaf ] Dan Carpenter found via Smatch static checker, that unsigned 'mtu_lo' is never less than zero. Variable mtu_lo should have been an 'int', because read_mtu_device_lo() uses minus as error indications. Fixes: b62eba563229 ("selftests/bpf: Tests using bpf_check_mtu BPF-helper") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/bpf/168605104733.3636467.17945947801753092590.stgit@firesoul Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/check_mtu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c
index 12f4395f18b3..a756760a45ed 100644
--- a/tools/testing/selftests/bpf/prog_tests/check_mtu.c
+++ b/tools/testing/selftests/bpf/prog_tests/check_mtu.c
@@ -183,7 +183,7 @@ cleanup:
void serial_test_check_mtu(void)
{
- __u32 mtu_lo;
+ int mtu_lo;
if (test__start_subtest("bpf_check_mtu XDP-attach"))
test_check_mtu_xdp_attach();