Return-Path: Received: from mail-dm3nam03on0136.outbound.protection.outlook.com ([104.47.41.136]:30240 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728089AbeH3WU0 (ORCPT ); Thu, 30 Aug 2018 18:20:26 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Dan Carpenter , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.4 18/30] powerpc: Fix size calculation using resource_size() Date: Thu, 30 Aug 2018 18:16:21 +0000 Message-ID: <20180830181533.36683-18-alexander.levin@microsoft.com> References: <20180830181533.36683-1-alexander.levin@microsoft.com> In-Reply-To: <20180830181533.36683-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 3f165d972a0e..994fe73c2ed0 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