]> git.hungrycats.org Git - linux/commitdiff
powerpc: Fix size calculation using resource_size()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 8 Aug 2018 11:57:24 +0000 (14:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:33:51 +0000 (08:33 +0200)
[ 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 <dan.carpenter@oracle.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/sysdev/mpic_msgr.c

index 7bdf3cc741e4fb1998f78808bfaff2ffecc99a4d..cfc3b9720763ea25e4aeb0b223635d20611f619c 100644 (file)
@@ -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;