lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Dec 2017 18:15:40 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     David Laight <David.Laight@...lab.com>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Joe Perches <joe@...ches.com>,
        Larry Finger <Larry.Finger@...inger.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] virt: vbox: use %pap format for printing resource_size_t

On Thu, Dec 21, 2017 at 6:02 PM, David Laight <David.Laight@...lab.com> wrote:
> 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@...db.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.

I made sure the type matches. I thought about changing it to size_t
and using %zd, but decided that it didn't matter.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ