Return-Path: Received: from mail-by2nam03on0127.outbound.protection.outlook.com ([104.47.42.127]:10160 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728096AbeH3WV4 (ORCPT ); Thu, 30 Aug 2018 18:21:56 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Dan Carpenter , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 3.18 13/25] powerpc: Fix size calculation using resource_size() Date: Thu, 30 Aug 2018 18:17:51 +0000 Message-ID: <20180830181716.36794-13-alexander.levin@microsoft.com> References: <20180830181716.36794-1-alexander.levin@microsoft.com> In-Reply-To: <20180830181716.36794-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Dan Carpenter [ Upstream commit c42d3be0c06f0c1c416054022aa535c08a1f9b39 ] 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 Reviewed-by: Tyrel Datwyler Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/mpic_msgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msg= r.c index 7bdf3cc741e4..cfc3b9720763 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) =20 /* IO map the message register block. */ of_address_to_resource(np, 0, &rsrc); - msgr_block_addr =3D ioremap(rsrc.start, rsrc.end - rsrc.start); + msgr_block_addr =3D ioremap(rsrc.start, resource_size(&rsrc)); if (!msgr_block_addr) { dev_err(&dev->dev, "Failed to iomap MPIC message registers"); return -EFAULT; --=20 2.17.1