diff options
| author | Yonghong Song <[email protected]> | 2021-11-12 20:48:38 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-11-12 22:11:46 +0000 |
| commit | 325d956d67178af92b5b12ff950a2f93a433f2c4 (patch) | |
| tree | 6a295bc8db626e139f4e1e7a1326d08e69e43285 /tools/bpf/bpftool/prog.c | |
| parent | selftests/bpf: Fix an unused-but-set-variable compiler warning (diff) | |
| download | kernel-325d956d67178af92b5b12ff950a2f93a433f2c4.tar.gz kernel-325d956d67178af92b5b12ff950a2f93a433f2c4.zip | |
selftests/bpf: Fix a tautological-constant-out-of-range-compare compiler warning
When using clang to build selftests with LLVM=1 in make commandline,
I hit the following compiler warning:
benchs/bench_bloom_filter_map.c:84:46: warning: result of comparison of constant 256
with expression of type '__u8' (aka 'unsigned char') is always false
[-Wtautological-constant-out-of-range-compare]
if (args.value_size < 2 || args.value_size > 256) {
~~~~~~~~~~~~~~~ ^ ~~~
The reason is arg.vaue_size has type __u8, so comparison "args.value_size > 256"
is always false.
This patch fixed the issue by doing proper comparison before assigning the
value to args.value_size. The patch also fixed the same issue in two
other places.
Signed-off-by: Yonghong Song <[email protected]>
Signed-off-by: Alexei Starovoitov <[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
