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  linux-cve-announce  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:	Wed, 10 Sep 2014 16:06:01 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Joe Perches <joe@...ches.com>
cc:	Dan Carpenter <dan.carpenter@...cle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	devel@...verdev.osuosl.org,
	"Dilger, Andreas" <andreas.dilger@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Peng Tao <bergwolf@...il.com>, kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"Drokin, Oleg" <oleg.drokin@...el.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: Warn on macros with flow control
 statements

On Wed, 10 Sep 2014, Joe Perches wrote:

> On Wed, 2014-09-10 at 11:43 +0300, Dan Carpenter wrote:
> > On Tue, Sep 09, 2014 at 01:38:13PM -0700, Joe Perches wrote:
> > > Macros with flow control statements (goto and return) are
> > > not very nice to read as any flow movement is unexpected.
>
> break and continue are also flow control statements
> but are those are frequently used in macros in
> complete switch statements so were not added.

Would it be possible to make a warning when there is a break or continue
but no while/switch/etc.

julia

> > > Try to highlight them and emit a warning on their definition.
> > >
> > > Avoid warning on macros that use argument concatenation as
> > > those macros commonly create another function where the
> > > concatenation is used in the function name definition like:
> > > 	#define FOO_FUNC(name, rtn_type)	\
> > > 	rtn_type func##name(arg1, ...)		\
> > > 	{					\
> > > 		rtn_type rtn;			\
> > > 		[code...]			\
> > > 		return rtn;			\
> > > 	}
> > >
> >
> > It adds 382 new warnings.
>
> Thanks for running it over the tree.
>
> > The '##' trick doesn't remove all then macros which create functions.
> > I can't think of a better way to do that though.
>
> Nor I.  I suppose it could be a --strict CHK and not
> a WARN message type though.
>
> > We will eventually get rid of almost all the warnings in staging.  The
> > one that makes sense to keep is:
> >
> > drivers/staging/lustre/lnet/selftest/selftest.h:559
> > #define STATE2STR(x) case x: return #x
>
> Yup, there are a few of those and they should
> definitely stay.
>
> > My guess is that other maintainers won't be as excited to change these...
>
> Do maintainers ever get excited about style?
>
> > Some of the macros have "RETURN", "RET" or "EXIT" in the name so the
> > return is not really hidden.
>
> Not sure what to do about that.
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ