mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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
This commit is contained in:
committed by
Daniel Borkmann
parent
04883a0799
commit
85e142cb42
@@ -185,13 +185,13 @@ ldx
|
|||||||
| OP_LDXB number '*' '(' '[' number ']' '&' number ')' {
|
| OP_LDXB number '*' '(' '[' number ']' '&' number ')' {
|
||||||
if ($2 != 4 || $9 != 0xf) {
|
if ($2 != 4 || $9 != 0xf) {
|
||||||
fprintf(stderr, "ldxb offset not supported!\n");
|
fprintf(stderr, "ldxb offset not supported!\n");
|
||||||
exit(0);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
|
bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
|
||||||
| OP_LDX number '*' '(' '[' number ']' '&' number ')' {
|
| OP_LDX number '*' '(' '[' number ']' '&' number ')' {
|
||||||
if ($2 != 4 || $9 != 0xf) {
|
if ($2 != 4 || $9 != 0xf) {
|
||||||
fprintf(stderr, "ldxb offset not supported!\n");
|
fprintf(stderr, "ldxb offset not supported!\n");
|
||||||
exit(0);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
|
bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
|
||||||
;
|
;
|
||||||
@@ -472,7 +472,7 @@ static void bpf_assert_max(void)
|
|||||||
{
|
{
|
||||||
if (curr_instr >= BPF_MAXINSNS) {
|
if (curr_instr >= BPF_MAXINSNS) {
|
||||||
fprintf(stderr, "only max %u insns allowed!\n", BPF_MAXINSNS);
|
fprintf(stderr, "only max %u insns allowed!\n", BPF_MAXINSNS);
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ static int bpf_find_insns_offset(const char *label)
|
|||||||
|
|
||||||
if (ret == -ENOENT) {
|
if (ret == -ENOENT) {
|
||||||
fprintf(stderr, "no such label \'%s\'!\n", label);
|
fprintf(stderr, "no such label \'%s\'!\n", label);
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user