All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Stepan Moskovchenko <stepanm@codeaurora.org>,
	Rob Landley <rob@landley.net>, George Spelvin <linux@horizon.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Andrei Emeltchenko <andrei.emeltchenko@intel.com>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: %pa format specifier issues
Date: Tue, 05 Mar 2013 17:18:28 -0800	[thread overview]
Message-ID: <51369964.6040101@linux.vnet.ibm.com> (raw)

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.


             reply	other threads:[~2013-03-06  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  1:18 Dave Hansen [this message]
2013-03-06  2:19 ` %pa format specifier issues Stephen Boyd
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=51369964.6040101@linux.vnet.ibm.com \
    --to=dave@linux.vnet.ibm.com \
    --cc=andrei.emeltchenko@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=mingo@elte.hu \
    --cc=rob@landley.net \
    --cc=sboyd@codeaurora.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.