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  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:	Thu, 3 Jul 2014 09:13:33 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Alexei Starovoitov' <>,
	Chema Gonzalez <>
CC:	"David S. Miller" <>,
	Ingo Molnar <>,
	Linus Torvalds <>,
	Steven Rostedt <>,
	Daniel Borkmann <>,
	Eric Dumazet <>,
	Peter Zijlstra <>,
	"Arnaldo Carvalho de Melo" <>,
	Jiri Olsa <>,
	"Thomas Gleixner" <>,
	"H. Peter Anvin" <>,
	"Andrew Morton" <>,
	Kees Cook <>,
	"Linux API" <>,
	Network Development <>,
	LKML <>
Subject: RE: [PATCH RFC net-next 08/14] bpf: add eBPF verifier

From: Alexei Starovoitov
> >> +#define _(OP) ({ int ret = OP; if (ret < 0) return ret; })
> > +1 to removing the _ macro. If you want to avoid the 3 lines (is there
> > anything in the style guide against "if ((err=OP) < 0) ..." ?), at
> assignment and function call inside 'if' ? I don't like such style.
> > least use some meaningful macro name (DO_AND_CHECK, or something like
> > that).

It would have to be RETURN_IF_NEGATIVE().
But even then it is skipped by searches for 'return'.

> Try replacing _ with any other name and see how bad it will look.
> I tried with MACRO_NAME and with 'if (err) goto' and with 'if (err) return',
> before I converged on _ macro.
> I think it's a hidden gem of this patch.

No, it is one of those things that 'seems like a good idea at the time',
but causes grief much later on.

Have you considered saving the error code into 'env' and making most of
the functions return if an error is set?
Then the calling code need not check the result of every function call.


Powered by blists - more mailing lists