* %pa format specifier issues
@ 2013-03-06 1:18 Dave Hansen
2013-03-06 2:19 ` Stephen Boyd
0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2013-03-06 1:18 UTC (permalink / raw)
To: Stepan Moskovchenko, Rob Landley, George Spelvin, Andy Shevchenko,
Stephen Boyd, Andrei Emeltchenko, Ingo Molnar, LKML
I went to go use the shiny new %pa specifier:
void test_printk_pa(void)
{
phys_addr_t p = 0x1234;
printk("p: %pa\n", p);
}
but gcc is spewing out warnings at me:
> arch/x86/mm/physaddr.c: In function ‘test_printk_pa’:
> arch/x86/mm/physaddr.c:95:2: warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘phys_addr_t’ [-Wformat]
I assume that's because gcc doesn't know about '%pa', and just assumes
it's a plain '%p'. Should we be turning these warnings off somehow?
Plus when I actually go to run it, vsnprintf() crashes the kernel, which
usually happens if printk()'s format doesn't match the size of its
arguments.
Am I doing something really stupid here?
This is using a 32-bit i386 kernel.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %pa format specifier issues
2013-03-06 1:18 %pa format specifier issues Dave Hansen
@ 2013-03-06 2:19 ` Stephen Boyd
2013-03-06 6:29 ` Dave Hansen
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2013-03-06 2:19 UTC (permalink / raw)
To: Dave Hansen
Cc: Stepan Moskovchenko, Rob Landley, George Spelvin, Andy Shevchenko,
Andrei Emeltchenko, Ingo Molnar, LKML
On 03/05/13 17:18, Dave Hansen wrote:
> I went to go use the shiny new %pa specifier:
>
> void test_printk_pa(void)
> {
> phys_addr_t p = 0x1234;
> printk("p: %pa\n", p);
> }
>
> but gcc is spewing out warnings at me:
>
>> arch/x86/mm/physaddr.c: In function ‘test_printk_pa’:
>> arch/x86/mm/physaddr.c:95:2: warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘phys_addr_t’ [-Wformat]
> I assume that's because gcc doesn't know about '%pa', and just assumes
> it's a plain '%p'. Should we be turning these warnings off somehow?
>
> Plus when I actually go to run it, vsnprintf() crashes the kernel, which
> usually happens if printk()'s format doesn't match the size of its
> arguments.
>
> Am I doing something really stupid here?
>
> This is using a 32-bit i386 kernel.
>
>From reading the patch I thought you had to pass the address via
reference. Otherwise you get the warning like you mention here, and then
probably an oops when the kernel tries to dereference 0x1234.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %pa format specifier issues
2013-03-06 2:19 ` Stephen Boyd
@ 2013-03-06 6:29 ` Dave Hansen
0 siblings, 0 replies; 3+ messages in thread
From: Dave Hansen @ 2013-03-06 6:29 UTC (permalink / raw)
To: Stephen Boyd
Cc: Stepan Moskovchenko, Rob Landley, George Spelvin, Andy Shevchenko,
Andrei Emeltchenko, Ingo Molnar, LKML
On 03/05/2013 06:19 PM, Stephen Boyd wrote:
>> >
>> > Am I doing something really stupid here?
>> >
>> > This is using a 32-bit i386 kernel.
>> >
>>From reading the patch I thought you had to pass the address via
> reference. Otherwise you get the warning like you mention here, and then
> probably an oops when the kernel tries to dereference 0x1234.
Heh, that would qualify as "really stupid". Thanks :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-06 6:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 1:18 %pa format specifier issues Dave Hansen
2013-03-06 2:19 ` Stephen Boyd
2013-03-06 6:29 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox