Skip to content

Commit 08ac0d3

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 <[email protected]> Signed-off-by: Kaixu Xia <[email protected]>
1 parent b883674 commit 08ac0d3

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,7 +9585,8 @@ 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;
9588+
s32 datasec_id;
9589+
u32 type, id = insn->imm;
95899590
const struct btf_var_secinfo *vsi;
95909591
const struct btf_type *datasec;
95919592
const struct btf_type *t;

0 commit comments

Comments
 (0)