* [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero
@ 2022-11-05 18:36 Kang Minchul
2022-11-05 18:45 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kang Minchul @ 2022-11-05 18:36 UTC (permalink / raw)
To: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
Jonathan Lemon
Cc: Martin KaFai Lau, Song Liu, Yonghong Song, Randy Dunlap, netdev,
linux-kernel, Kang Minchul
Variable ret is compared with less than zero even though it was set as u32.
So u32 to int conversion is needed.
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
tools/testing/selftests/bpf/xskxceiver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 681a5db80dae..162d3a516f2c 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1006,7 +1006,8 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd
{
struct xsk_socket_info *xsk = ifobject->xsk;
bool use_poll = ifobject->use_poll;
- u32 i, idx = 0, ret, valid_pkts = 0;
+ u32 i, idx = 0, valid_pkts = 0;
+ int ret;
while (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) < BATCH_SIZE) {
if (use_poll) {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero
2022-11-05 18:36 [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero Kang Minchul
@ 2022-11-05 18:45 ` Randy Dunlap
2022-11-06 12:21 ` Björn Töpel
2022-11-08 1:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2022-11-05 18:45 UTC (permalink / raw)
To: Kang Minchul, Björn Töpel, Magnus Karlsson,
Maciej Fijalkowski, Jonathan Lemon
Cc: Martin KaFai Lau, Song Liu, Yonghong Song, netdev, linux-kernel
On 11/5/22 11:36, Kang Minchul wrote:
> Variable ret is compared with less than zero even though it was set as u32.
> So u32 to int conversion is needed.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 681a5db80dae..162d3a516f2c 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -1006,7 +1006,8 @@ static int __send_pkts(struct ifobject *ifobject, u32 *pkt_nb, struct pollfd *fd
> {
> struct xsk_socket_info *xsk = ifobject->xsk;
> bool use_poll = ifobject->use_poll;
> - u32 i, idx = 0, ret, valid_pkts = 0;
> + u32 i, idx = 0, valid_pkts = 0;
> + int ret;
>
> while (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) < BATCH_SIZE) {
> if (use_poll) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero
2022-11-05 18:36 [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero Kang Minchul
2022-11-05 18:45 ` Randy Dunlap
@ 2022-11-06 12:21 ` Björn Töpel
2022-11-08 1:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Björn Töpel @ 2022-11-06 12:21 UTC (permalink / raw)
To: Kang Minchul, Magnus Karlsson, Maciej Fijalkowski, Jonathan Lemon
Cc: Martin KaFai Lau, Song Liu, Yonghong Song, Randy Dunlap, netdev,
linux-kernel, Kang Minchul
Kang Minchul <tegongkang@gmail.com> writes:
> Variable ret is compared with less than zero even though it was set as u32.
> So u32 to int conversion is needed.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero
2022-11-05 18:36 [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero Kang Minchul
2022-11-05 18:45 ` Randy Dunlap
2022-11-06 12:21 ` Björn Töpel
@ 2022-11-08 1:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-08 1:00 UTC (permalink / raw)
To: Kang Minchul
Cc: bjorn, magnus.karlsson, maciej.fijalkowski, jonathan.lemon,
martin.lau, song, yhs, rdunlap, netdev, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Sun, 6 Nov 2022 03:36:56 +0900 you wrote:
> Variable ret is compared with less than zero even though it was set as u32.
> So u32 to int conversion is needed.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [v3] selftests/bpf: Fix u32 variable compared with less than zero
https://git.kernel.org/bpf/bpf-next/c/e8f50c4f0c14
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:[~2022-11-08 1:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-05 18:36 [PATCH v3] selftests/bpf: Fix u32 variable compared with less than zero Kang Minchul
2022-11-05 18:45 ` Randy Dunlap
2022-11-06 12:21 ` Björn Töpel
2022-11-08 1:00 ` 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