lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 16 Mar 2020 17:24:52 -0700
From:   Martin KaFai Lau <kafai@...com>
To:     Quentin Monnet <quentin@...valent.com>
CC:     <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>, <kernel-team@...com>,
        <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 4/4] bpftool: Add struct_ops support

On Mon, Mar 16, 2020 at 11:54:28AM +0000, Quentin Monnet wrote:

> [...]
> 
> > +static int do_unregister(int argc, char **argv)
> > +{
> > +	const char *search_type, *search_term;
> > +	struct res res;
> > +
> > +	if (argc != 2)
> > +		usage();
> 
> Or you could reuse the macros in main.h, for more consistency with other
> subcommands:
> 
> 	if (!REQ_ARGS(2))
> 		return -1;
Thanks for the review!

I prefer to print out "usage();" whenever possible but then "-j" gave
me a 'null' after a json error mesage ...

# bpftool -j struct_ops unregister
{"error":"'unregister' needs at least 2 arguments, 0 found"},null

Then I went without REQ_ARGS(2) which is similar to a few existing
cases like do_dump(), do_updaate()...etc in map.c.

That was my consideration.  However, I can go back to use REQ_ARGS(2)
and return -1 without printing usage.  no strong preference here.

Powered by blists - more mailing lists