From: Jesper Dangaard Brouer brouer@redhat.com
[ 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@... Signed-off-by: Sasha Levin sashal@kernel.org --- tools/testing/selftests/bpf/prog_tests/check_mtu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c index 12f4395f18b37..a756760a45edb 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 @@ static void test_check_mtu_tc(__u32 mtu, __u32 ifindex)
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();