linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix size calculation using resource_size()
@ 2018-08-08 11:57 Dan Carpenter
  2018-08-08 21:43 ` Tyrel Datwyler
  2018-08-13 11:23 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-08-08 11:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Jia Hongtao
  Cc: Paul Mackerras, Michael Ellerman, Rob Herring, Tyrel Datwyler,
	linuxppc-dev, kernel-janitors

The problem is the the calculation should be "end - start + 1" but the
plus one is missing in this calculation.

Fixes: 8626816e905e ("powerpc: add support for MPIC message register API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  Not tested.

diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index eb69a5186243..280e964e1aa8 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
 
 	/* IO map the message register block. */
 	of_address_to_resource(np, 0, &rsrc);
-	msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start);
+	msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc));
 	if (!msgr_block_addr) {
 		dev_err(&dev->dev, "Failed to iomap MPIC message registers");
 		return -EFAULT;

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

* Re: [PATCH] powerpc: fix size calculation using resource_size()
  2018-08-08 11:57 [PATCH] powerpc: fix size calculation using resource_size() Dan Carpenter
@ 2018-08-08 21:43 ` Tyrel Datwyler
  2018-08-13 11:23 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Tyrel Datwyler @ 2018-08-08 21:43 UTC (permalink / raw)
  To: Dan Carpenter, Benjamin Herrenschmidt, Jia Hongtao
  Cc: Paul Mackerras, Michael Ellerman, Rob Herring, linuxppc-dev,
	kernel-janitors

On 08/08/2018 04:57 AM, Dan Carpenter wrote:
> The problem is the the calculation should be "end - start + 1" but the
> plus one is missing in this calculation.
> 
> Fixes: 8626816e905e ("powerpc: add support for MPIC message register API")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static analysis.  Not tested.

Looks sane to me.

Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

> 
> diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
> index eb69a5186243..280e964e1aa8 100644
> --- a/arch/powerpc/sysdev/mpic_msgr.c
> +++ b/arch/powerpc/sysdev/mpic_msgr.c
> @@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
> 
>  	/* IO map the message register block. */
>  	of_address_to_resource(np, 0, &rsrc);
> -	msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start);
> +	msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc));
>  	if (!msgr_block_addr) {
>  		dev_err(&dev->dev, "Failed to iomap MPIC message registers");
>  		return -EFAULT;
> 

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

* Re: powerpc: fix size calculation using resource_size()
  2018-08-08 11:57 [PATCH] powerpc: fix size calculation using resource_size() Dan Carpenter
  2018-08-08 21:43 ` Tyrel Datwyler
@ 2018-08-13 11:23 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-08-13 11:23 UTC (permalink / raw)
  To: Dan Carpenter, Benjamin Herrenschmidt, Jia Hongtao
  Cc: Rob Herring, kernel-janitors, Paul Mackerras, Tyrel Datwyler,
	linuxppc-dev

On Wed, 2018-08-08 at 11:57:24 UTC, Dan Carpenter wrote:
> The problem is the the calculation should be "end - start + 1" but the
> plus one is missing in this calculation.
> 
> Fixes: 8626816e905e ("powerpc: add support for MPIC message register API")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c42d3be0c06f0c1c416054022aa535

cheers

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

end of thread, other threads:[~2018-08-13 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08 11:57 [PATCH] powerpc: fix size calculation using resource_size() Dan Carpenter
2018-08-08 21:43 ` Tyrel Datwyler
2018-08-13 11:23 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).