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]
Message-Id: <e899781c-304c-4494-a544-e3950e928e55@www.fastmail.com>
Date:   Tue, 04 May 2021 14:27:01 +0930
From:   "Andrew Jeffery" <andrew@...id.au>
To:     "Randy Dunlap" <rdunlap@...radead.org>,
        linux-kernel@...r.kernel.org
Cc:     "kbuild test robot" <lkp@...el.com>, linux-aspeed@...ts.ozlabs.org,
        "Mauro Carvalho Chehab" <mchehab@...nel.org>,
        "Tony Luck" <tony.luck@...el.com>,
        "Borislav Petkov" <bp@...en8.de>,
        "Stefan M Schaeckeler" <sschaeck@...co.com>,
        "Borislav Petkov" <bp@...e.de>, linux-edac@...r.kernel.org,
        "Arnd Bergmann" <arnd@...nel.org>
Subject: Re: [PATCH] EDAC: aspeed: print resource_size_t using %pa



On Tue, 4 May 2021, at 02:04, Randy Dunlap wrote:
> Fix build warnings for using "%x" to print resource_size_t in 2 places.
> resource_size_t can be either of u32 or u64. We have a special format
> "%pa" for printing a resource_size_t, which is the same as a phys_addr_t.
> See Documentation/core-api/printk-formats.rst.
> 
>   CC      drivers/edac/aspeed_edac.o
> ../drivers/edac/aspeed_edac.c: In function 'init_csrows':
> ../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects 
> argument of type 'unsigned int', but argument 4 has type 
> 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> ../drivers/edac/aspeed_edac.c:257:21: warning: format '%x' expects 
> argument of type 'unsigned int', but argument 5 has type 
> 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
>   257 |  dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> 
> Fixes: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
> Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
> Reported-by: kernel test robot <lkp@...el.com>
> Cc: Troy Lee <troy_lee@...eedtech.com>
> Cc: Stefan Schaeckeler <sschaeck@...co.com>
> Cc: linux-edac@...r.kernel.org
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Borislav Petkov <bp@...e.de>
> Cc: Mauro Carvalho Chehab <mchehab@...nel.org>
> Cc: Tony Luck <tony.luck@...el.com>
> Cc: linux-aspeed@...ts.ozlabs.org
> ---
> Found in linux-next but applies to mainline.

> 
>  drivers/edac/aspeed_edac.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> --- linux-next-20210503.orig/drivers/edac/aspeed_edac.c
> +++ linux-next-20210503/drivers/edac/aspeed_edac.c
> @@ -234,6 +234,7 @@ static int init_csrows(struct mem_ctl_in
>  	u32 nr_pages, dram_type;
>  	struct dimm_info *dimm;
>  	struct device_node *np;
> +	resource_size_t rsize;
>  	struct resource r;
>  	u32 reg04;
>  	int rc;
> @@ -254,11 +255,12 @@ static int init_csrows(struct mem_ctl_in
>  		return rc;
>  	}
>  
> -	dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%x, resource_size=0x%x, PAGE_SHIFT macro=0x%x\n",
> -		r.start, resource_size(&r), PAGE_SHIFT);
> +	rsize = resource_size(&r);
> +	dev_dbg(mci->pdev, "dt: /memory node resources: first page 
> r.start=0x%pa, resource_size=0x%pa, PAGE_SHIFT macro=0x%x\n",
> +		&r.start, &rsize, PAGE_SHIFT);

Arnd posted a fix a few days back that feels more intuitive, though 
probably could have cleaned up the grammar:

https://lore.kernel.org/lkml/20210421135500.3518661-1-arnd@kernel.org/

Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ