Re: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

From: Helge Deller
Date: Thu Sep 07 2017 - 02:05:04 EST


On 07.09.2017 02:45, Sergey Senozhatsky wrote:
> On (09/06/17 22:27), Helge Deller wrote:
>> This patch series fixes the wrong usages of the %pF and %pS printk format
>> specifiers throughout the kernel code.
>>
>> Both specifiers have the same result on most architectures. But on ia64, ppc64
>> and parisc64 architectures the %pF specifier does an extra conversion because
>> there function pointers are actually function descriptors.
>
> hm...
> can we fix it in lib/vsprintf.c instead?

There is nothing to fix in vsprintf, because it is already providing
both %pF and %pS for the two different architecture-specific API call
implementations.

> a) the patch set has "there is no problem on platform A, but still
> let's just change it"
>
> which is probably fine. but
>
> b) you tweak/fix the currently existing users, OK. but there, most
> likely, will be new users that will require fixes in the future.

Please read the documentation in Documentation/printk-formats.txt.

It's really as simple that if you use function pointers you *need to*
use %pF, and if you use raw addresses of functions, you *need to* use
%pS. If you use the correct specifier the output will automatically
be correct for all architectures. If you don't, then the output on
ia64, ppc64 and parisc64 architectures will be wrong and may lead
to kernel crashes in the worst case.

My patch series simply fixes that code which has it wrong.
It has no impact at all on users on x86, ARM, mips and
other platforms.

Helge