From: Stephen Boyd <sboyd@codeaurora.org>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Stepan Moskovchenko <stepanm@codeaurora.org>,
Rob Landley <rob@landley.net>, George Spelvin <linux@horizon.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrei Emeltchenko <andrei.emeltchenko@intel.com>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: %pa format specifier issues
Date: Tue, 05 Mar 2013 18:19:54 -0800 [thread overview]
Message-ID: <5136A7CA.70308@codeaurora.org> (raw)
In-Reply-To: <51369964.6040101@linux.vnet.ibm.com>
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
next prev parent reply other threads:[~2013-03-06 2:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 1:18 %pa format specifier issues Dave Hansen
2013-03-06 2:19 ` Stephen Boyd [this message]
2013-03-06 6:29 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5136A7CA.70308@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=andrei.emeltchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dave@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=mingo@elte.hu \
--cc=rob@landley.net \
--cc=stepanm@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox