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]
Date:	Mon, 04 Aug 2014 18:17:51 -0700
From:	Hans Wennborg <hans@...shq.net>
To:	Joe Perches <joe@...ches.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: Add test for printf formats with 0x that
 emit decimal

On 08/03/2014 08:46 PM, Joe Perches wrote:
> On Sun, 2014-08-03 at 20:03 -0700, Hans Wennborg wrote:
>> On 08/03/2014 07:50 PM, Joe Perches wrote:
>>> 0x%<foo> should be used to emit hexadecimal values.
>>>
>>> Uses of 0x%[udi] emit decimal values but these should
>>> probably instead use 0x%x variants.
>>>
>>> Warn on these uses.
>>
>> Good idea!
> []
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>>> @@ -4985,6 +4985,10 @@ sub process {
>>>    		while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
>>>    			$string = substr($rawline, $-[1], $+[1] - $-[1]);
>>>    			$string =~ s/%%/__/g;
>>> +			if ($string =~ /(0x(?<!%)%[0-9.\*]*[Ll]*[udi])(?![xX])/) {
>>
>> Maybe the regex should have a \b to check for a word boundary before the
>> 0 to avoid matching things like "800x%d"? (I don't know if that occurs
>> in the kernel, but I've seen it elsewhere.)
>
> Maybe.
>
> Code it to do the appropriate thing and test it too.
> See if there any other cases that should be emitted.

I grepped with your regex over the code and didn't get any false 
positives, so it seems fine. Feel free to ignore my previous comment.

Thanks,
Hans
--
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