aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/kpc2000/kpc_spi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-04-30 13:33:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-30 14:19:04 +0200
commitf998a1180e14d0a10d2ffeccec25779ace879c2a (patch)
tree986c349f59e3259c109f790d10b67cde5866be77 /drivers/staging/kpc2000/kpc_spi
parentstaging: kpc2000: Fix a stack information leak in kp2000_cdev_ioctl() (diff)
downloadlinux-dev-f998a1180e14d0a10d2ffeccec25779ace879c2a.tar.xz
linux-dev-f998a1180e14d0a10d2ffeccec25779ace879c2a.zip
staging: kpc2000: fix resource size calculation
The code is calculating the resource size wrong because it should be inclusive of the "res->end" address. In other words, "end - start + 1". We can just use the resource_size() function to do it correctly. Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/kpc2000/kpc_spi')
-rw-r--r--drivers/staging/kpc2000/kpc_spi/spi_driver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/kpc2000/kpc_spi/spi_driver.c b/drivers/staging/kpc2000/kpc_spi/spi_driver.c
index c0999e080577..074a578153d0 100644
--- a/drivers/staging/kpc2000/kpc_spi/spi_driver.c
+++ b/drivers/staging/kpc2000/kpc_spi/spi_driver.c
@@ -452,7 +452,7 @@ kp_spi_probe(struct platform_device *pldev)
goto free_master;
}
- kpspi->phys = (unsigned long)ioremap_nocache(r->start, r->end - r->start);
+ kpspi->phys = (unsigned long)ioremap_nocache(r->start, resource_size(r));
kpspi->base = (u64 __iomem *)kpspi->phys;
status = spi_register_master(master);