Skip to content

Commit e2c8826

Browse files
borkmannAlexei Starovoitov
authored andcommitted
libbpf: Drop redundant self-loop in emit_check_err
When the cleanup-label jump offset does not fit in s16, emit_check_err() sets gen->error = -ERANGE and then emits a BPF_JMP_IMM(BPF_JA, 0, 0, -1) self-loop. The latter emit() is dead: gen->error is assigned on the preceding line, and emit() then bails out early in realloc_insn_buf() the moment gen->error is set, so the jump is never written into the instruction stream. gen->error alone already marks the generation as failed. This is a follow-up to 7dd6256 ("libbpf: fix off-by-one in emit_signature_match jump offset") which removed the jump in emit_signature_match() but not in other locations. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/r/20260529094119.307264-1-daniel@iogearbox.net Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 7c7c42d commit e2c8826

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

tools/lib/bpf/gen_loader.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ static void emit_check_err(struct bpf_gen *gen)
293293
emit(gen, BPF_JMP_IMM(BPF_JSLT, BPF_REG_7, 0, off));
294294
} else {
295295
gen->error = -ERANGE;
296-
emit(gen, BPF_JMP_IMM(BPF_JA, 0, 0, -1));
297296
}
298297
}
299298

0 commit comments

Comments
 (0)