public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl/acpi: Use printk specifier for resource
@ 2023-07-17 10:26 Breno Leitao
  2023-07-17 16:28 ` Dave Jiang
  2023-07-18 17:58 ` Verma, Vishal L
  0 siblings, 2 replies; 4+ messages in thread
From: Breno Leitao @ 2023-07-17 10:26 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: leit, kernel test robot, open list:COMPUTE EXPRESS LINK (CXL),
	open list

Commit 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
is using %llx to print resources pointers, but it is incorrect on 32-bits
system, causing the following compilation warning on i386:

	 drivers/cxl/acpi.c:300:4: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]

Instead of using pointers to the resource, uses the proper printk
specifier that knows how to handle the struct "resources".

This is the new format, being printed now:

	Failed to add decode range: [mem 0x4080000000-0x2baffffffff flags 0x200]

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307151059.2vvBt55H-lkp@intel.com/
Fixes: 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/cxl/acpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
index 815b43859c16..d1c559879dcc 100644
--- a/drivers/cxl/acpi.c
+++ b/drivers/cxl/acpi.c
@@ -296,8 +296,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
 	else
 		rc = cxl_decoder_autoremove(dev, cxld);
 	if (rc) {
-		dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n",
-			res->start, res->end);
+		dev_err(dev, "Failed to add decode range: %pr", res);
 		return rc;
 	}
 	dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cxl/acpi: Use printk specifier for resource
  2023-07-17 10:26 [PATCH] cxl/acpi: Use printk specifier for resource Breno Leitao
@ 2023-07-17 16:28 ` Dave Jiang
  2023-07-18  9:29   ` Jonathan Cameron
  2023-07-18 17:58 ` Verma, Vishal L
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Jiang @ 2023-07-17 16:28 UTC (permalink / raw)
  To: Breno Leitao, Davidlohr Bueso, Jonathan Cameron, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: leit, kernel test robot, open list:COMPUTE EXPRESS LINK (CXL),
	open list



On 7/17/23 03:26, Breno Leitao wrote:
> Commit 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> is using %llx to print resources pointers, but it is incorrect on 32-bits
> system, causing the following compilation warning on i386:
> 
> 	 drivers/cxl/acpi.c:300:4: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
> 
> Instead of using pointers to the resource, uses the proper printk
> specifier that knows how to handle the struct "resources".
> 
> This is the new format, being printed now:
> 
> 	Failed to add decode range: [mem 0x4080000000-0x2baffffffff flags 0x200]
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307151059.2vvBt55H-lkp@intel.com/
> Fixes: 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   drivers/cxl/acpi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 815b43859c16..d1c559879dcc 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -296,8 +296,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
>   	else
>   		rc = cxl_decoder_autoremove(dev, cxld);
>   	if (rc) {
> -		dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n",
> -			res->start, res->end);
> +		dev_err(dev, "Failed to add decode range: %pr", res);
>   		return rc;
>   	}
>   	dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n",

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cxl/acpi: Use printk specifier for resource
  2023-07-17 16:28 ` Dave Jiang
@ 2023-07-18  9:29   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-07-18  9:29 UTC (permalink / raw)
  To: Dave Jiang
  Cc: Breno Leitao, Davidlohr Bueso, Alison Schofield, Vishal Verma,
	Ira Weiny, Dan Williams, leit, kernel test robot,
	open list:COMPUTE EXPRESS LINK (CXL), open list

On Mon, 17 Jul 2023 09:28:47 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> On 7/17/23 03:26, Breno Leitao wrote:
> > Commit 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> > is using %llx to print resources pointers, but it is incorrect on 32-bits
> > system, causing the following compilation warning on i386:
> > 
> > 	 drivers/cxl/acpi.c:300:4: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
> > 
> > Instead of using pointers to the resource, uses the proper printk
> > specifier that knows how to handle the struct "resources".
> > 
> > This is the new format, being printed now:
> > 
> > 	Failed to add decode range: [mem 0x4080000000-0x2baffffffff flags 0x200]
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202307151059.2vvBt55H-lkp@intel.com/
> > Fixes: 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> > Suggested-by: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Breno Leitao <leitao@debian.org>  
> 
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>

FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> > ---
> >   drivers/cxl/acpi.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> > index 815b43859c16..d1c559879dcc 100644
> > --- a/drivers/cxl/acpi.c
> > +++ b/drivers/cxl/acpi.c
> > @@ -296,8 +296,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
> >   	else
> >   		rc = cxl_decoder_autoremove(dev, cxld);
> >   	if (rc) {
> > -		dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n",
> > -			res->start, res->end);
> > +		dev_err(dev, "Failed to add decode range: %pr", res);
> >   		return rc;
> >   	}
> >   	dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n",  
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cxl/acpi: Use printk specifier for resource
  2023-07-17 10:26 [PATCH] cxl/acpi: Use printk specifier for resource Breno Leitao
  2023-07-17 16:28 ` Dave Jiang
@ 2023-07-18 17:58 ` Verma, Vishal L
  1 sibling, 0 replies; 4+ messages in thread
From: Verma, Vishal L @ 2023-07-18 17:58 UTC (permalink / raw)
  To: Williams, Dan J, Jiang, Dave, jonathan.cameron@huawei.com,
	leitao@debian.org, dave@stgolabs.net, Weiny, Ira,
	Schofield, Alison
  Cc: Leitao, Breno, linux-cxl@vger.kernel.org,
	linux-kernel@vger.kernel.org, lkp

On Mon, 2023-07-17 at 03:26 -0700, Breno Leitao wrote:
> Commit 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> is using %llx to print resources pointers, but it is incorrect on 32-bits
> system, causing the following compilation warning on i386:
> 
>          drivers/cxl/acpi.c:300:4: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
> 
> Instead of using pointers to the resource, uses the proper printk
> specifier that knows how to handle the struct "resources".
> 
> This is the new format, being printed now:
> 
>         Failed to add decode range: [mem 0x4080000000-0x2baffffffff flags 0x200]
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307151059.2vvBt55H-lkp@intel.com/
> Fixes: 3840e10e8dca ("cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()")
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  drivers/cxl/acpi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I squashed this in with the original use-after-free patch. Since this
fixes a compile warning with the original patch, squashing is
appropriate even if it results in rebasing the fixes branch.

> 
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 815b43859c16..d1c559879dcc 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -296,8 +296,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
>         else
>                 rc = cxl_decoder_autoremove(dev, cxld);
>         if (rc) {
> -               dev_err(dev, "Failed to add decode range [%#llx - %#llx]\n",
> -                       res->start, res->end);
> +               dev_err(dev, "Failed to add decode range: %pr", res);
>                 return rc;
>         }
>         dev_dbg(dev, "add: %s node: %d range [%#llx - %#llx]\n",


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-18 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 10:26 [PATCH] cxl/acpi: Use printk specifier for resource Breno Leitao
2023-07-17 16:28 ` Dave Jiang
2023-07-18  9:29   ` Jonathan Cameron
2023-07-18 17:58 ` Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox