* [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type
@ 2023-06-06 11:30 Jesper Dangaard Brouer
2023-06-06 11:32 ` Jesper Dangaard Brouer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2023-06-06 11:30 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, bpf
Cc: Jesper Dangaard Brouer, netdev, kernel-janitors
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(-)
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();
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type
2023-06-06 11:30 [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type Jesper Dangaard Brouer
@ 2023-06-06 11:32 ` Jesper Dangaard Brouer
2023-06-06 15:05 ` Simon Horman
2023-06-06 15:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2023-06-06 11:32 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, bpf
Cc: brouer, netdev, kernel-janitors
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();
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type
2023-06-06 11:30 [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type Jesper Dangaard Brouer
2023-06-06 11:32 ` Jesper Dangaard Brouer
@ 2023-06-06 15:05 ` Simon Horman
2023-06-06 15:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-06-06 15:05 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko, bpf, netdev,
kernel-janitors
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type
2023-06-06 11:30 [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type Jesper Dangaard Brouer
2023-06-06 11:32 ` Jesper Dangaard Brouer
2023-06-06 15:05 ` Simon Horman
@ 2023-06-06 15:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-06 15:10 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: borkmann, ast, andrii.nakryiko, bpf, netdev, kernel-janitors
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-06 15:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06 11:30 [PATCH bpf-next V1] selftests/bpf: Fix check_mtu using wrong variable type Jesper Dangaard Brouer
2023-06-06 11:32 ` Jesper Dangaard Brouer
2023-06-06 15:05 ` Simon Horman
2023-06-06 15:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).