linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Jia Hongtao <B38951@freescale.com>
Cc: Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Rob Herring <robh@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] powerpc: fix size calculation using resource_size()
Date: Wed, 8 Aug 2018 14:43:02 -0700	[thread overview]
Message-ID: <a5411d3a-8c2c-0a4f-7e3f-baa473c34e92@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180808115724.gh5mbbi6twzqbqao@kili.mountain>

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;
> 

  reply	other threads:[~2018-08-08 21:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 11:57 [PATCH] powerpc: fix size calculation using resource_size() Dan Carpenter
2018-08-08 21:43 ` Tyrel Datwyler [this message]
2018-08-13 11:23 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5411d3a-8c2c-0a4f-7e3f-baa473c34e92@linux.vnet.ibm.com \
    --to=tyreld@linux.vnet.ibm.com \
    --cc=B38951@freescale.com \
    --cc=benh@kernel.crashing.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).