bpf_map01: Fix inverted condition for array map lookup pass
PATCH 1/1 bpf_map01: Fix inverted condition for array map lookup pass
From: Avinesh Kumar <[email protected]>
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.
--- testcases/kernel/syscalls/bpf/bpf_map01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/bpf/bpf_map01.c +1 -1
@@ -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" );
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 5 lines
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_SZinstead.
Thanks for an obvious fix, merged!
Kind regards,
Petr
Quoted 20 lines
Fixes b51732825077 ("BPF: Sanity check creating and updating maps")Signed-off-by Avinesh Kumar <[email protected]>--- testcases/kernel/syscalls/bpf/bpf_map01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/syscalls/bpf/bpf_map01.c +1
-1@@ -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" );
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp