[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191115180044.83659-1-andriy.shevchenko@linux.intel.com>
Date: Fri, 15 Nov 2019 20:00:40 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: linux-kernel@...r.kernel.org, Christoph Hellwig <hch@....de>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>,
Arnd Bergmann <arnd@...db.de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Ard Biesheuvel <ardb@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Cornelia Huck <cohuck@...hat.com>
Subject: [PATCH v1 1/5] memremap: Check for size parameter
There is no use of memremap() to be called with size = 0.
Simple return NULL pointer and allow callers to drop this check.
Fixes: 92281dee825f ("arch: introduce memremap()")
Cc: Christoph Hellwig <hch@....de>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: Robin Murphy <robin.murphy@....com>
Cc: Jaroslav Kysela <perex@...ex.cz>
Cc: Takashi Iwai <tiwai@...e.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: Alex Williamson <alex.williamson@...hat.com>
Cc: Cornelia Huck <cohuck@...hat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
kernel/iomem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/iomem.c b/kernel/iomem.c
index 62c92e43aa0d..bf7a5fc32760 100644
--- a/kernel/iomem.c
+++ b/kernel/iomem.c
@@ -74,6 +74,9 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
void *addr = NULL;
+ if (!size)
+ return NULL;
+
if (!flags)
return NULL;
--
2.24.0
Powered by blists - more mailing lists