Message ID | 168605104733.3636467.17945947801753092590.stgit@firesoul (mailing list archive) |
---|---|
State | Accepted |
Commit | 095641817e1bf6aa2560e025e47575188ee3edaf |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next,V1] selftests/bpf: Fix check_mtu using wrong variable type | expand |
On 06/06/2023 13.30, Jesper Dangaard Brouer wrote: > 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. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> > --- > tools/testing/selftests/bpf/prog_tests/check_mtu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Providing the fixes like that I forgot. Fixes: b62eba563229 ("selftests/bpf: Tests using bpf_check_mtu BPF-helper") > diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c > index 5338d2ea0460..2a9a30650350 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(); > >
On Tue, Jun 06, 2023 at 01:30:47PM +0200, Jesper Dangaard Brouer wrote: > 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. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Reviewed-by: Simon Horman <simon.horman@corigine.com>
Hello: This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <daniel@iogearbox.net>: On Tue, 06 Jun 2023 13:30:47 +0200 you wrote: > 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. > > Reported-by: Dan Carpenter <dan.carpenter@linaro.org> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> > > [...] Here is the summary with links: - [bpf-next,V1] selftests/bpf: Fix check_mtu using wrong variable type https://git.kernel.org/bpf/bpf-next/c/095641817e1b You are awesome, thank you!
diff --git a/tools/testing/selftests/bpf/prog_tests/check_mtu.c b/tools/testing/selftests/bpf/prog_tests/check_mtu.c index 5338d2ea0460..2a9a30650350 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();
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. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> --- tools/testing/selftests/bpf/prog_tests/check_mtu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)