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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2014 14:05:12 +0200
From:	Javier Martinez Canillas <javier@...hile0.org>
To:	Lars-Peter Clausen <lars@...afoo.de>
Cc:	Julia Lawall <Julia.Lawall@...6.fr>, Michal Marek <mmarek@...e.cz>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Coccinelle <cocci@...teme.lip6.fr>
Subject: Re: [Cocci] [PATCH v2 1/1] scripts/coccinelle: use BIT macro if used

Hello Lars,

On Tue, Apr 29, 2014 at 6:18 PM, Lars-Peter Clausen <lars@...afoo.de> wrote:
> On 04/27/2014 12:50 PM, Javier Martinez Canillas wrote:
>>
>> Using the BIT() macro instead of manually shifting bits
>> makes the code less error prone.
>>
>> If is more readable is a matter of taste so only replace
>> if the file is already using this macro.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@...hile0.org>
>
>
> I don't think this should be enabled by default. It will generate a ton of
> false positives, not everything that is 1 shifted by something is a
> single-bit field. E.g. imagine a device with multi-bit fields:
>
> #define FOOBAR_A (0 << FOOBAR_OFFSET)
> #define FOOBAR_B (1 << FOOBAR_OFFSET)
> #define FOOBAR_C (2 << FOOBAR_OFFSET)
> #define FOOBAR_D (3 << FOOBAR_OFFSET)
>
> The script will now suggest to replace FOOBAR_B (1 << FOOBAR_OFFSET) with
> FOOBAR_B BIT(FOOBAR_OFFSET). Which is technically correct, but not
> semantically.
>
> - Lars
>
>

Thanks a lot for your feedback. You are complete right that this is
hard to generalize so is better to just drop this patch.

I'll just continue it keeping it on my tree since I find it useful.

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