Commit 1e6f5dcc authored by Ian Rogers's avatar Ian Rogers Committed by Daniel Borkmann

tools, bpftool: Avoid array index warnings.

The bpf_caps array is shorter without CAP_BPF, avoid out of bounds reads
if this isn't defined. Working around this avoids -Wno-array-bounds with
clang.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarTobias Klauser <tklauser@distanz.ch>
Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201027233646.3434896-1-irogers@google.com
parent e5e1a4bc
...@@ -843,9 +843,14 @@ static int handle_perms(void) ...@@ -843,9 +843,14 @@ static int handle_perms(void)
else else
p_err("missing %s%s%s%s%s%s%s%srequired for full feature probing; run as root or use 'unprivileged'", p_err("missing %s%s%s%s%s%s%s%srequired for full feature probing; run as root or use 'unprivileged'",
capability_msg(bpf_caps, 0), capability_msg(bpf_caps, 0),
#ifdef CAP_BPF
capability_msg(bpf_caps, 1), capability_msg(bpf_caps, 1),
capability_msg(bpf_caps, 2), capability_msg(bpf_caps, 2),
capability_msg(bpf_caps, 3)); capability_msg(bpf_caps, 3)
#else
"", "", "", "", "", ""
#endif /* CAP_BPF */
);
goto exit_free; goto exit_free;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment