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]
Message-ID: <CACxGe6ufcUtu7NioLdNSLmy8nWHr_E4FpQrmyhPrH0Qee+13SA@mail.gmail.com>
Date:	Thu, 3 Jul 2014 17:57:38 +0100
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Joe Perches <joe@...ches.com>
Cc:	"Maciej W. Rozycki" <macro@...ux-mips.org>,
	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] declance: Fix 64-bit compilation warnings

On Thu, Jul 3, 2014 at 7:25 AM, Joe Perches <joe@...ches.com> wrote:
> On Thu, 2014-07-03 at 07:01 +0100, Maciej W. Rozycki wrote:
>> On Wed, 2 Jul 2014, Joe Perches wrote:
>>
>> > > > The kernel vsprintf implementation doesn't prefix
>> > > > pointers with 0x, so you can use 0x%p if you really
>> > > > want that with a leading prefix, but you don't have
>> > > > to use it.
>> > >
>> > >  It does, when the `#' format modifier is used (go try yourself!).
>> >
>> > I know it does, but it's incidental.
>>
>>  Is it?  Someone took the effort to handle it:
>>
>>       int default_width = 2 * sizeof(void *) + (spec.flags & SPECIAL ? 2 : 0);
>>
>> while they could do:
>>
>>       int default_width = 2 * sizeof(void *);
>>
>>       spec.flags &= ~SPECIAL;
>
> Grant Likely did that a couple of years ago.
>
> commit 725fe002d315c2501c110b7245d3eb4f4535f4d6
> Author: Grant Likely <grant.likely@...retlab.ca>
> Date:   Thu May 31 16:26:08 2012 -0700
>
>     vsprintf: correctly handle width when '#' flag used in %#p format
>
>     The '%p' output of the kernel's vsprintf() uses spec.field_width to
>     determine how many digits to output based on 2 * sizeof(void*) so that all
>     digits of a pointer are shown.  ie.  a pointer will be output as
>     "001A2B3C" instead of "1A2B3C".  However, if the '#' flag is used in the
>     format (%#p), then the code doesn't take into account the width of the
>     '0x' prefix and will end up outputing "0x1A2B3C" instead of "0x001A2B3C".
>
>     This patch reworks the "pointer()" format hook to include 2 characters for
>     the '0x' prefix if the '#' flag is included.
>
> Not sure it ever mattered myself.

I had code using it. It was long enough ago that I'd don't remember
exactly why. Apparently it never made it into the kernel or it got
reverted by someone else.

g.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ