From: Ricardo Ribalda Delgado Date: Thu, 4 Oct 2018 13:01:04 +0000 (+0200) Subject: mtd: maps: gpio-addr-flash: Fix ioremapped size X-Git-Tag: rel_imx_4.19.35_1.1.0~9068 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=53772af08acd3e5143a5c1e6f7b8ddd3cabb350f;p=linux.git mtd: maps: gpio-addr-flash: Fix ioremapped size commit 6c925b333368cda4e1b0513b07f72316c0e7edd7 upstream. We should only iomap the area of the chip that is memory mapped. Otherwise we could be mapping devices beyond the memory space or that belong to other devices. Signed-off-by: Ricardo Ribalda Delgado Fixes: ebd71e3a4861 ("mtd: maps: gpio-addr-flash: fix warnings and make more portable") Cc: Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 9d9723693217..2e3a8da3ce72 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c @@ -238,7 +238,7 @@ static int gpio_flash_probe(struct platform_device *pdev) state->map.copy_to = gf_copy_to; state->map.bankwidth = pdata->width; state->map.size = state->win_size * (1 << state->gpio_count); - state->map.virt = ioremap_nocache(memory->start, state->map.size); + state->map.virt = ioremap_nocache(memory->start, state->win_size); if (!state->map.virt) return -ENOMEM;