]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix unsigned 'datasec_id' compared with zero in check_pseudo_btf_id
authorKaixu Xia <kaixuxia@tencent.com>
Wed, 11 Nov 2020 05:03:46 +0000 (13:03 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Nov 2020 09:50:22 +0000 (10:50 +0100)
commit73b443b70c01b633bf5f155527907ed76bf5886c
tree41eac337a24c16ea550360f0a33ad344972e8ee9
parentbac72ba1589fda09a51006cfd5179672ddc4cb7a
bpf: Fix unsigned 'datasec_id' compared with zero in check_pseudo_btf_id

The unsigned variable datasec_id is assigned a return value from the call
to check_pseudo_btf_id(), which may return negative error code.

This fixes the following coccicheck warning:

  ./kernel/bpf/verifier.c:9616:5-15: WARNING: Unsigned expression compared with zero: datasec_id > 0

Fixes: 876b6eed9700 ("bpf: Introduce bpf_per_cpu_ptr()")
Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Cc: Hao Luo <haoluo@google.com>
Link: https://lore.kernel.org/bpf/1605071026-25906-1-git-send-email-kaixuxia@tencent.com
kernel/bpf/verifier.c