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:   Tue, 17 Jan 2023 16:56:36 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Arnd Bergmann <arnd@...db.de>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Arnd Bergmann <arnd@...nel.org>
Cc:     Vincent Shih <vincent.sunplus@...il.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtc: sunplus: fix format string for printing resource



On 1/17/23 11:36, Arnd Bergmann wrote:
> On Tue, Jan 17, 2023, at 19:24, Randy Dunlap wrote:
>> On 1/17/23 09:55, Alexandre Belloni wrote:
>>> On 17/01/2023 18:24:44+0100, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@...db.de>
>>>>
>>>> On 32-bit architectures with 64-bit resource_size_t, sp_rtc_probe()
>>>> causes a compiler warning:
>>>>
>>>> drivers/rtc/rtc-sunplus.c: In function 'sp_rtc_probe':
>>>> drivers/rtc/rtc-sunplus.c:243:33: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Werror=format=]
>>>>   243 |         dev_dbg(&plat_dev->dev, "res = 0x%x, reg_base = 0x%lx\n",
>>>>       |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>> The best way to print a resource is the special %pR format string,
>>>> and similarly to print a pointer we can use %p and avoid the cast.
>>>>
>>>
>>> I got this one this morning, which one is more correct? :)
>>> https://lore.kernel.org/all/20230117054232.24023-1-rdunlap@infradead.org/
> 
> Both are equally correct, it's just a preference.
> 
>> I prefer my handling of res->start and Arnd's no-cast handling of reg_base.
>> IMO using "%pR" prints too much info, but that's more up to the file's author
>> or maintainer...
> 
> Right, I could have equally well picked the %pap version, and just
> went for brevity in the source. It's only pr_debug(), so very few
> users are going to actually see the output.

Alexandre, sounds like you should just go with Arnd's patch.

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ