Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools, bpf_asm: Exit non-zero on errors

... so callers can correctly detect failure.

Signed-off-by: Ian Denhardt <ian@zenhack.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/b0bea780bc292f29e7b389dd062f20adc2a2d634.1614201868.git.ian@zenhack.net

authored by

Ian Denhardt and committed by
Daniel Borkmann
85e142cb 04883a07

+4 -4
+4 -4
tools/bpf/bpf_exp.y
··· 185 185 | OP_LDXB number '*' '(' '[' number ']' '&' number ')' { 186 186 if ($2 != 4 || $9 != 0xf) { 187 187 fprintf(stderr, "ldxb offset not supported!\n"); 188 - exit(0); 188 + exit(1); 189 189 } else { 190 190 bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } } 191 191 | OP_LDX number '*' '(' '[' number ']' '&' number ')' { 192 192 if ($2 != 4 || $9 != 0xf) { 193 193 fprintf(stderr, "ldxb offset not supported!\n"); 194 - exit(0); 194 + exit(1); 195 195 } else { 196 196 bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } } 197 197 ; ··· 472 472 { 473 473 if (curr_instr >= BPF_MAXINSNS) { 474 474 fprintf(stderr, "only max %u insns allowed!\n", BPF_MAXINSNS); 475 - exit(0); 475 + exit(1); 476 476 } 477 477 } 478 478 ··· 522 522 523 523 if (ret == -ENOENT) { 524 524 fprintf(stderr, "no such label \'%s\'!\n", label); 525 - exit(0); 525 + exit(1); 526 526 } 527 527 528 528 return ret;