Skip to content

Commit 5a6690b

Browse files
kaixuxiakxkernel-patches-bot
authored andcommitted
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. Fixes coccicheck warning: ./kernel/bpf/verifier.c:9616:5-15: WARNING: Unsigned expression compared with zero: datasec_id > 0 Reported-by: Tosk Robot <tencent_os_robot@tencent.com> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
1 parent ccf8d80 commit 5a6690b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9585,12 +9585,13 @@ static int check_pseudo_btf_id(struct bpf_verifier_env *env,
95859585
struct bpf_insn *insn,
95869586
struct bpf_insn_aux_data *aux)
95879587
{
9588-
u32 datasec_id, type, id = insn->imm;
95899588
const struct btf_var_secinfo *vsi;
95909589
const struct btf_type *datasec;
95919590
const struct btf_type *t;
95929591
const char *sym_name;
95939592
bool percpu = false;
9593+
u32 type, id = insn->imm;
9594+
s32 datasec_id;
95949595
u64 addr;
95959596
int i;
95969597

0 commit comments

Comments
 (0)