From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxYvb-0003Zk-3C for linux-mtd@lists.infradead.org; Wed, 05 Sep 2018 14:37:27 +0000 Received: by mail-ed1-x542.google.com with SMTP id h33-v6so6263997edb.5 for ; Wed, 05 Sep 2018 07:36:56 -0700 (PDT) From: Ricardo Ribalda Delgado To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Zhouyang Jia , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org (open list) Cc: Ricardo Ribalda Delgado , stable@vger.kernel.org Subject: [PATCH v2 2/8] mtd: maps: gpio-addr-flash: Fix ioremapped size Date: Wed, 5 Sep 2018 16:36:37 +0200 Message-Id: <20180905143643.9871-3-ricardo.ribalda@gmail.com> In-Reply-To: <20180905143643.9871-1-ricardo.ribalda@gmail.com> References: <20180905143643.9871-1-ricardo.ribalda@gmail.com> List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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: --- Changelog v2: >>From Boris Brezillon: -Add Fixes and cc:stable 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 17be47f72973..6de16e81994c 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c @@ -234,7 +234,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; -- 2.18.0