From: Mikael Pettersson <mikpe@it.uu.se>
To: "Steven Noonan" <steven@uplinklabs.net>
Cc: "Ingo Molnar" <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
"Jeremy Fitzhardinge" <jeremy@goop.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Hugh Dickins" <hugh@veritas.com>,
"Jesse Barnes" <jbarnes@virtuousgeek.org>
Subject: Re: drivers/pci/probe.c compile warnings on -tip
Date: Wed, 1 Oct 2008 12:47:57 +0200 [thread overview]
Message-ID: <18659.21853.41967.715062@harpo.it.uu.se> (raw)
In-Reply-To: <f488382f0810010102y551f4a3bs64524fa70ef04ca3@mail.gmail.com>
Steven Noonan writes:
> I was hunting down some warnings I got when compiling -tip, and with
> one of them, I'm not sure what would be a proper way to handle it.
>
> If CONFIG_PHYS_ADDR_T_64BIT is not enabled, these warnings show up:
>
> drivers/pci/probe.c: In function '__pci_read_base':
> drivers/pci/probe.c:308: warning: format '%llx' expects type 'long
> long unsigned int', but argument 4 has type 'resource_size_t'
> drivers/pci/probe.c:308: warning: format '%llx' expects type 'long
> long unsigned int', but argument 5 has type 'resource_size_t'
> drivers/pci/probe.c:320: warning: format '%llx' expects type 'long
> long unsigned int', but argument 5 has type 'resource_size_t'
> drivers/pci/probe.c:320: warning: format '%llx' expects type 'long
> long unsigned int', but argument 6 has type 'resource_size_t'
> drivers/pci/probe.c: In function 'pci_read_bridge_bases':
> drivers/pci/probe.c:392: warning: format '%llx' expects type 'long
> long unsigned int', but argument 3 has type 'resource_size_t'
> drivers/pci/probe.c:392: warning: format '%llx' expects type 'long
> long unsigned int', but argument 4 has type 'resource_size_t'
> drivers/pci/probe.c:405: warning: format '%llx' expects type 'long
> long unsigned int', but argument 3 has type 'resource_size_t'
> drivers/pci/probe.c:405: warning: format '%llx' expects type 'long
> long unsigned int', but argument 4 has type 'resource_size_t'
> drivers/pci/probe.c:443: warning: format '%llx' expects type 'long
> long unsigned int', but argument 4 has type 'resource_size_t'
> drivers/pci/probe.c:443: warning: format '%llx' expects type 'long
> long unsigned int', but argument 5 has type 'resource_size_t'
>
>
> Each of the lines is something like this:
>
> printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> pci_name(dev), pos, res->start, res->end);
>
> res->start and res->end are resource_size_t (which is phys_addr_t),
> and are sized either 32-bit or 64-bit, based on whether
> CONFIG_PHYS_ADDR_T_64BIT is set.
Oh not those again. Similar warnings in 27-rc's drivers/pci
were fixed recently, but apparently someone out there likes
to create new ones.
The fix is to cast the resource_size_t arguments to unsigned long long.
With "%llx" that's the /only/ valid argument type.
Also note that these warnings aren't harmless. On 32-bit machines
with parameters passed on the stack the mismatch in size between
32-bit resource_size_t and the 64-bit %llx causes undefined
behaviour as printk mis-enumerates its parameters.
/Mikael
next prev parent reply other threads:[~2008-10-01 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-01 8:02 Steven Noonan
2008-10-01 10:47 ` Mikael Pettersson [this message]
2008-10-01 15:51 ` Jesse Barnes
2008-10-05 3:55 ` Steven Noonan
2008-10-05 10:18 ` Ingo Molnar
2008-10-05 18:06 ` Yinghai Lu
2008-10-06 6:21 ` Ingo Molnar
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=18659.21853.41967.715062@harpo.it.uu.se \
--to=mikpe@it.uu.se \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=hugh@veritas.com \
--cc=jbarnes@virtuousgeek.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=steven@uplinklabs.net \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®