From: sdf@google.com
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Quentin Monnet <quentin@isovalent.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2] bpftool: Check argc first before "file" in do_batch()
Date: Tue, 15 Nov 2022 10:42:28 -0800 [thread overview]
Message-ID: <Y3PdlPVxobFMVYoX@google.com> (raw)
In-Reply-To: <1668517207-11822-1-git-send-email-yangtiezhu@loongson.cn>
On 11/15, Tiezhu Yang wrote:
> If the parameters for batch are more than 2, check argc first can
> return immediately, no need to use is_prefix() to check "file" with
> a little overhead and then check argc, it is better to check "file"
> only when the parameters for batch are 2.
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Stanislav Fomichev <sdf@google.com>
> ---
> tools/bpf/bpftool/main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
> index 741e50e..337ab79 100644
> --- a/tools/bpf/bpftool/main.c
> +++ b/tools/bpf/bpftool/main.c
> @@ -337,12 +337,12 @@ static int do_batch(int argc, char **argv)
> if (argc < 2) {
> p_err("too few parameters for batch");
> return -1;
> - } else if (!is_prefix(*argv, "file")) {
> - p_err("expected 'file', got: %s", *argv);
> - return -1;
> } else if (argc > 2) {
> p_err("too many parameters for batch");
> return -1;
> + } else if (!is_prefix(*argv, "file")) {
> + p_err("expected 'file', got: %s", *argv);
> + return -1;
> }
> NEXT_ARG();
> --
> 2.1.0
next prev parent reply other threads:[~2022-11-15 18:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 13:00 [PATCH bpf-next v2] bpftool: Check argc first before "file" in do_batch() Tiezhu Yang
2022-11-15 18:42 ` sdf [this message]
2022-11-15 20:19 ` Quentin Monnet
2022-11-16 5:40 ` patchwork-bot+netdevbpf
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=Y3PdlPVxobFMVYoX@google.com \
--to=sdf@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=quentin@isovalent.com \
--cc=yangtiezhu@loongson.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.