* [LTP] [PATCH] bpf_map01: Fix inverted condition for array map lookup pass
@ 2026-09-22 15:37 Avinesh Kumar via ltp
2026-09-22 17:17 ` Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Avinesh Kumar via ltp @ 2026-09-22 15:37 UTC (permalink / raw)
To: ltp
From: Avinesh Kumar <avinesh.kumar@suse.com>
The check "if (i < VAL_SZ)" after the zero-value scan loop is
backwards: it fires TPASS only when the loop broke early (i.e.
a non-zero byte was found and TFAIL already reported), and stays
silent when the loop completes normally with all zeros as expected.
Report TPASS when i == VAL_SZ instead.
Fixes: b51732825077 ("BPF: Sanity check creating and updating maps")
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
testcases/kernel/syscalls/bpf/bpf_map01.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/bpf/bpf_map01.c b/testcases/kernel/syscalls/bpf/bpf_map01.c
index 7fcf8e00fe4e..97cebf6bf6f3 100644
--- a/testcases/kernel/syscalls/bpf/bpf_map01.c
+++ b/testcases/kernel/syscalls/bpf/bpf_map01.c
@@ -82,7 +82,7 @@ void run(unsigned int n)
break;
}
}
- if (i < VAL_SZ)
+ if (i == VAL_SZ)
tst_res(TPASS, "Preallocated array map lookup");
} else {
tst_res(TFAIL | TTERRNO, "Prellocated array map lookup");
--
2.55.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [LTP] [PATCH] bpf_map01: Fix inverted condition for array map lookup pass
2026-09-22 15:37 [LTP] [PATCH] bpf_map01: Fix inverted condition for array map lookup pass Avinesh Kumar via ltp
@ 2026-09-22 17:17 ` Petr Vorel
0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2026-09-22 17:17 UTC (permalink / raw)
To: Avinesh Kumar; +Cc: ltp
Hi Avinesh,
> The check "if (i < VAL_SZ)" after the zero-value scan loop is
> backwards: it fires TPASS only when the loop broke early (i.e.
> a non-zero byte was found and TFAIL already reported), and stays
> silent when the loop completes normally with all zeros as expected.
> Report TPASS when i == VAL_SZ instead.
Thanks for an obvious fix, merged!
Kind regards,
Petr
> Fixes: b51732825077 ("BPF: Sanity check creating and updating maps")
> Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
> ---
> testcases/kernel/syscalls/bpf/bpf_map01.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/testcases/kernel/syscalls/bpf/bpf_map01.c b/testcases/kernel/syscalls/bpf/bpf_map01.c
> index 7fcf8e00fe4e..97cebf6bf6f3 100644
> --- a/testcases/kernel/syscalls/bpf/bpf_map01.c
> +++ b/testcases/kernel/syscalls/bpf/bpf_map01.c
> @@ -82,7 +82,7 @@ void run(unsigned int n)
> break;
> }
> }
> - if (i < VAL_SZ)
> + if (i == VAL_SZ)
> tst_res(TPASS, "Preallocated array map lookup");
> } else {
> tst_res(TFAIL | TTERRNO, "Prellocated array map lookup");
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-22 17:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22 15:37 [LTP] [PATCH] bpf_map01: Fix inverted condition for array map lookup pass Avinesh Kumar via ltp
2026-09-22 17:17 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.