From: David Laight <David.Laight@ACULAB.COM>
To: "'Arnd Bergmann'" <arnd@arndb.de>,
Hans de Goede <hdegoede@redhat.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>,
Larry Finger <Larry.Finger@lwfinger.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] virt: vbox: use %pap format for printing resource_size_t
Date: Thu, 21 Dec 2017 17:02:45 +0000 [thread overview]
Message-ID: <689442a126b5446e846e5d5af340e51c@AcuMS.aculab.com> (raw)
In-Reply-To: <20171221161529.3462263-1-arnd@arndb.de>
From: Arnd Bergmann
> Sent: 21 December 2017 16:15
>
> resource_size_t may be larger than pointers depending on configuration,
> so we can run into this build warning:
>
> drivers/virt/vboxguest/vboxguest_linux.c: In function 'vbg_pci_probe':
> drivers/virt/vboxguest/vboxguest_linux.c:295:4: error: cast to pointer from integer of different size
> [-Werror=int-to-pointer-cast]
> drivers/virt/vboxguest/vboxguest_linux.c:367:4: error: cast to pointer from integer of different size
> [-Werror=int-to-pointer-cast]
>
> This uses the special %pap to print the address by reference.
>
> Fixes: 0ba002bc4393 ("virt: Add vboxguest driver for Virtual Box Guest integration")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: Use %pap instead of the %rR that was just as incorrect, as
> pointed out by Joe Perches.
> ---
> drivers/virt/vboxguest/vboxguest_linux.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c
> index d045aa51ce03..82e280d38cc2 100644
> --- a/drivers/virt/vboxguest/vboxguest_linux.c
> +++ b/drivers/virt/vboxguest/vboxguest_linux.c
> @@ -291,8 +291,8 @@ static int vbg_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
>
> vmmdev = devm_ioremap(dev, mmio, mmio_len);
> if (!vmmdev) {
> - vbg_err("vboxguest: Error ioremap failed; MMIO addr=%p size=%d\n",
> - (void *)mmio, (int)mmio_len);
> + vbg_err("vboxguest: Error ioremap failed; MMIO addr=%pap size=%pap\n",
> + &mmio, &mmio_len);
Are you sure about the type of mmio_len?
While the argument to devm_ioremap() is of type resource_size_t it seems
extremely unlikely that the actual value will exceed 2^32.
Using a 64bit type for the length on 32bit systems will generate horrid code.
I can't see the code in my tree to check.
David
next prev parent reply other threads:[~2017-12-21 17:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 16:15 [PATCH v2] virt: vbox: use %pap format for printing resource_size_t Arnd Bergmann
2017-12-21 17:02 ` David Laight [this message]
2017-12-21 17:15 ` Arnd Bergmann
2017-12-22 12:03 ` Hans de Goede
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=689442a126b5446e846e5d5af340e51c@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Larry.Finger@lwfinger.net \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).