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] [day] [month] [year] [list]
Message-ID: <7058A061-03C6-4C09-9A82-5F4DADB0FA01@intel.com>
Date:	Wed, 10 Sep 2014 14:52:47 +0000
From:	"Drokin, Oleg" <oleg.drokin@...el.com>
To:	Joe Perches <joe@...ches.com>
CC:	Julia Lawall <julia.lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"<devel@...verdev.osuosl.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>" <kernel-janitors@...r.kernel.org>,
	"<linux-kernel@...r.kernel.org>" <linux-kernel@...r.kernel.org>,
	"Andy Whitcroft" <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: Warn on macros with flow control statements

Hello!

On Sep 10, 2014, at 10:36 AM, Joe Perches wrote:

> On Wed, 2014-09-10 at 16:06 +0200, Julia Lawall wrote:
>> 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.
> 
> I suppose the has_flow_statement could be extended.
> 
> Maybe something like:
> 
> 			if ($ctx =~ /\b(goto|return|break|continue)\b/ &&
> 			    $ctx !~ /\b(switch|if|do|while)\b/) {
> 				has_flow_statement = 1;
> 			}
> 
> but checkpatch isn't really capable  of doing proper
> flow logic analysis.

While possibly not really suitable in checkpatch, it might be a good addition to
some static code analyzer as a "future bugs possible due to this" check.

Bye,
    Oleg--
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