Return-Path: Received: from mail-sn1nam02on0119.outbound.protection.outlook.com ([104.47.36.119]:53312 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727234AbeH3WSA (ORCPT ); Thu, 30 Aug 2018 18:18:00 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Dan Carpenter , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.9 24/42] powerpc: Fix size calculation using resource_size() Date: Thu, 30 Aug 2018 18:14:02 +0000 Message-ID: <20180830181245.36526-24-alexander.levin@microsoft.com> References: <20180830181245.36526-1-alexander.levin@microsoft.com> In-Reply-To: <20180830181245.36526-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 db2286be5d9a..47fb336741d4 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