]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Fix array bounds warning in jit_disasm_helpers
authorIhor Solodrai <ihor.solodrai@linux.dev>
Mon, 23 Feb 2026 19:07:33 +0000 (11:07 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Feb 2026 16:19:49 +0000 (08:19 -0800)
commit3e711c8e4707c46cc45d9775b50204d0f2790d77
treecf6eb06de01427aa16955be4e0eaabf22ffe76e6
parent2bb270a0ac68990648c5e84abf73bb7493230ea6
selftests/bpf: Fix array bounds warning in jit_disasm_helpers

Compiler cannot infer upper bound for labels.cnt and warns about
potential buffer overflow in snprintf. Add an explicit bounds
check (... && i < MAX_LOCAL_LABELS) in the loop condition to fix the
warning.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260223190736.649171-18-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/jit_disasm_helpers.c