netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Denhardt <ian@zenhack.net>
To: ast@kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [PATCH 2/2] tools, bpf_asm: exit non-zero on errors.
Date: Tue, 23 Feb 2021 21:24:00 -0500	[thread overview]
Message-ID: <b36c61004609b6499992ec08c8b69a255ab9a55d.1614201304.git.ian@zenhack.net> (raw)
In-Reply-To: <cover.1614201303.git.ian@zenhack.net>

...so callers can correctly detect failure.

Signed-off-by: Ian Denhardt <ian@zenhack.net>
---
 tools/bpf/bpf_exp.y | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/bpf/bpf_exp.y b/tools/bpf/bpf_exp.y
index 8d03e5245da5..dfb7254a24e8 100644
--- a/tools/bpf/bpf_exp.y
+++ b/tools/bpf/bpf_exp.y
@@ -185,13 +185,13 @@ ldx
 	| OP_LDXB number '*' '(' '[' number ']' '&' number ')' {
 		if ($2 != 4 || $9 != 0xf) {
 			fprintf(stderr, "ldxb offset not supported!\n");
-			exit(0);
+			exit(1);
 		} else {
 			bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
 	| OP_LDX number '*' '(' '[' number ']' '&' number ')' {
 		if ($2 != 4 || $9 != 0xf) {
 			fprintf(stderr, "ldxb offset not supported!\n");
-			exit(0);
+			exit(1);
 		} else {
 			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) {
 		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) {
 		fprintf(stderr, "no such label \'%s\'!\n", label);
-		exit(0);
+		exit(1);
 	}
 
 	return ret;
-- 
2.30.1


  parent reply	other threads:[~2021-02-24 21:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 21:15 [PATCH 0/2] More strict error checking in bpf_asm (v2) Ian Denhardt
2021-02-24  2:15 ` [PATCH 1/2] tools, bpf_asm: Hard error on out of range jumps Ian Denhardt
2021-02-24  2:24 ` Ian Denhardt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-24 21:24 [PATCH 0/2] More strict error checking in bpf_asm (v3) Ian Denhardt
2021-02-24  2:24 ` [PATCH 2/2] tools, bpf_asm: exit non-zero on errors Ian Denhardt
2021-02-24  2:36 [PATCH 0/2] More strict error checking in bpf_asm Ian Denhardt
2021-02-24  2:24 ` [PATCH 2/2] tools, bpf_asm: exit non-zero on errors Ian Denhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b36c61004609b6499992ec08c8b69a255ab9a55d.1614201304.git.ian@zenhack.net \
    --to=ian@zenhack.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).