From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754645AbdLURCa convert rfc822-to-8bit (ORCPT ); Thu, 21 Dec 2017 12:02:30 -0500 Received: from smtp-out6.electric.net ([192.162.217.184]:61900 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753872AbdLURC0 (ORCPT ); Thu, 21 Dec 2017 12:02:26 -0500 From: David Laight To: "'Arnd Bergmann'" , Hans de Goede , "Greg Kroah-Hartman" CC: Joe Perches , Larry Finger , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] virt: vbox: use %pap format for printing resource_size_t Thread-Topic: [PATCH v2] virt: vbox: use %pap format for printing resource_size_t Thread-Index: AQHTencJm5gKYopI1EGvsZ/7E2QqpKNOBSAQ Date: Thu, 21 Dec 2017 17:02:45 +0000 Message-ID: <689442a126b5446e846e5d5af340e51c@AcuMS.aculab.com> References: <20171221161529.3462263-1-arnd@arndb.de> In-Reply-To: <20171221161529.3462263-1-arnd@arndb.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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