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:	Sun, 27 Apr 2014 12:24:57 +0200
From:	Javier Martinez Canillas <javier@...hile0.org>
To:	Julia Lawall <julia.lawall@...6.fr>
Cc:	Wolfram Sang <wsa@...-dreams.de>, Michal Marek <mmarek@...e.cz>,
	Nicolas Palix <nicolas.palix@...g.fr>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Coccinelle <cocci@...teme.lip6.fr>
Subject: Re: [Cocci] [PATCH 1/1] scripts/coccinelle: use BIT() macro if possible

Hello Julia,

On Sun, Apr 27, 2014 at 11:36 AM, Julia Lawall <julia.lawall@...6.fr> wrote:
>
>
> On Sun, 27 Apr 2014, Javier Martinez Canillas wrote:
>
>> Hello Wolfram,
>>
>> Thanks a lot for your feedback.
>>
>> On Sun, Apr 27, 2014 at 7:14 AM, Wolfram Sang <wsa@...-dreams.de> wrote:
>> > On Sun, Apr 27, 2014 at 02:29:46AM +0200, Javier Martinez Canillas wrote:
>> >> Using the BIT() macro instead of manually shifting bits
>> >> makes the code less error prone and also more readable.
>> >
>> > Does it? It is a taste thing, yet I don't think it makes the code that
>> > much more readable that it is worth changing the whole tree.
>> >
>>
>> I believe there is a reason for that macro but yes I agree with you
>> that is a matter of taste and the it shouldn't be enforced.
>>
>> I'm doing a big refactoring for the GPIO subsystem and was told to use
>> coccinelle so this patch was part of my learning. I posted it because
>> I thought that it could be useful but I don't mind the patch to be
>> dropped if that is not the case.
>
> Perhaps it could be useful in files that already use BIT somewhere?
>

Well the semantic patch already has a rule that checks if the file
includes <linux/bitops.h> so files that don't include this header will
be skipped.

I've checked and in most cases when that header is included is because
at least the BIT macro is used once on the file. My guess is that the
original author included the header and used the macro but other
people modifying the file after its original creation just used 1 << n
instead.

But as I said, I've no strong opinion about this patch. I just used to
learn the basics of SmPL and to cleanup a driver I maintain and
thought it was a good touch to post it in case more people find it
useful.

> julia

Thanks a lot and best regards,
Javier
--
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