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: <5cf03008e8784b7797feaf3d8ccfa303@AcuMS.aculab.com>
Date:   Thu, 14 Oct 2021 08:27:17 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Bernd Petrovitsch' <bernd@...rovitsch.priv.at>,
        'Joe Perches' <joe@...ches.com>,
        LKML <linux-kernel@...r.kernel.org>
CC:     kernel-janitors <kernel-janitors@...r.kernel.org>
Subject: RE: Use of '%#02x' is almost always wrong

From: Bernd Petrovitsch
> Sent: 14 October 2021 00:16
> 
> On 12/10/2021 23:10, David Laight wrote:
> [...]
> >> So presumably all the uses of %#02x in the kernel are not outputting
> >> what is actually expected.  Perhaps all of these should use %#04x.
> >
> > Doesn't help. The definition of "%#x" is completely broken.
> 
> Seconded ...
> 
> > Basically 0 doesn't get the "0x" prefix, so "%#04x" outputs
> > "0000".
> 
> ... just because of that.
> And if one get's in touch with tools where format strings are
> the % -stuff is not consistently used ...
> 
> > "0000" if the value is zero.
> > So the correct replacement is (probably) "0x%02x".
> 
> At least it's consistent that way.
> 
> And in the big techie picture, I don't see what the '#' modifer
> buys and why it makes sense to use it.

It works for "%#8x" where it add the "0x" to the right-aligned
hex digits.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ