From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Tobias Klauser <tklauser@distanz.ch>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf] tools, bpftool: check return value of function codegen
Date: Wed, 10 Jun 2020 11:50:06 -0700 [thread overview]
Message-ID: <CAEf4Bzbiz6qST5Ws4pKB4qZdqfwG_12UgFeQk96da1qipAJS9Q@mail.gmail.com> (raw)
In-Reply-To: <20200610130807.21497-1-tklauser@distanz.ch>
On Wed, Jun 10, 2020 at 6:09 AM Tobias Klauser <tklauser@distanz.ch> wrote:
>
> The codegen function might fail an return an error. Check its return
> value in all call sites and handle it properly.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
codegen() can fail only if the system ran out of memory or the static
template is malformed. Both are highly unlikely. I wonder if the
better approach would be to just exit(1) on such an unlikely error
inside codegen() and make the function itself void-returning.
We'll probably expand codegen to other languages soon, so not having
to do those annoying error checks everywhere is a good thing.
What do you think?
[...]
next prev parent reply other threads:[~2020-06-10 18:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 13:08 [PATCH bpf] tools, bpftool: check return value of function codegen Tobias Klauser
2020-06-10 18:50 ` Andrii Nakryiko [this message]
2020-06-11 9:05 ` Tobias Klauser
2020-06-11 10:33 ` [PATCH] tools, bpftool: Exit on error in " Tobias Klauser
2020-06-11 18:02 ` Andrii Nakryiko
2020-06-11 21:55 ` Daniel Borkmann
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=CAEf4Bzbiz6qST5Ws4pKB4qZdqfwG_12UgFeQk96da1qipAJS9Q@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=tklauser@distanz.ch \
/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).