Re: [PATCH v1 1/1] lib/vsprintf: refactor duplicate code to xnumber()

From: Andy Shevchenko
Date: Mon Dec 28 2015 - 17:29:11 EST


On Tue, Dec 29, 2015 at 12:20 AM, Rasmus Villemoes
<linux@xxxxxxxxxxxxxxxxxx> wrote:
> On Mon, Dec 28 2015, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> wrote:
>
>>
>> Is there any aspect of the passed-through printf_spec which isn't
>> overridden in xnumber? The users are/will be various %p extensions,
>> which probably means that no-one passes a non-default precision (gcc
>> complains about %.*p), and the remaining possible flags (PLUS, LEFT,
>> SPACE) are useless and/or impossible to pass to %p
>
> Actually, LEFT can be passed to %p (or get set by passing a negative
> field width via %*p), which would be actively harmful: When LEFT is set,
> number() explicitly removes the ZEROPAD flag, so we'd get "0xabcdef "
> instead of "0x00abcdef".

My opinion we have to establish strict rules what we print in case of
prefixed pointer (when #ifdef is false in some cases, e.g. struct clk)
or fixed type values, such as phys_addr_t. I mean to always have a
maximum width for the type on the running architecture.

--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/