aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorYonghong Song <[email protected]>2022-06-13 05:43:14 +0000
committerDaniel Borkmann <[email protected]>2022-06-14 15:01:54 +0000
commitc49a44b39b313a4191ca2f06316c547ee673264e (patch)
tree07804cbfb15725bbea1db0e9a2b0ba15c6dfcfcf /tools/bpf/bpftool/prog.c
parentbpf: Fix spelling in bpf_verifier.h (diff)
downloadkernel-c49a44b39b313a4191ca2f06316c547ee673264e.tar.gz
kernel-c49a44b39b313a4191ca2f06316c547ee673264e.zip
libbpf: Fix an unsigned < 0 bug
Andrii reported a bug with the following information: 2859 if (enum64_placeholder_id == 0) { 2860 enum64_placeholder_id = btf__add_int(btf, "enum64_placeholder", 1, 0); >>> CID 394804: Control flow issues (NO_EFFECT) >>> This less-than-zero comparison of an unsigned value is never true. "enum64_placeholder_id < 0U". 2861 if (enum64_placeholder_id < 0) 2862 return enum64_placeholder_id; 2863 ... Here enum64_placeholder_id declared as '__u32' so enum64_placeholder_id < 0 is always false. Declare enum64_placeholder_id as 'int' in order to capture the potential error properly. Fixes: f2a625889bb8 ("libbpf: Add enum64 sanitization") Reported-by: Andrii Nakryiko <[email protected]> Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions