lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191115180044.83659-2-andriy.shevchenko@linux.intel.com>
Date:   Fri, 15 Nov 2019 20:00:41 +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>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Robin Murphy <robin.murphy@....com>
Subject: [PATCH v1 2/5] dma-mapping: Drop duplicate check for size parameter of memremap()

Since memremap() returns NULL pointer for size = 0, there is no need
to duplicate this check in the callers.

Cc: Christoph Hellwig <hch@....de>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: Robin Murphy <robin.murphy@....com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 kernel/dma/coherent.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c
index 551b0eb7028a..7e669c083324 100644
--- a/kernel/dma/coherent.c
+++ b/kernel/dma/coherent.c
@@ -42,16 +42,11 @@ static int dma_init_coherent_memory(phys_addr_t phys_addr,
 		struct dma_coherent_mem **mem)
 {
 	struct dma_coherent_mem *dma_mem = NULL;
-	void *mem_base = NULL;
+	void *mem_base;
 	int pages = size >> PAGE_SHIFT;
 	int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
 	int ret;
 
-	if (!size) {
-		ret = -EINVAL;
-		goto out;
-	}
-
 	mem_base = memremap(phys_addr, size, MEMREMAP_WC);
 	if (!mem_base) {
 		ret = -EINVAL;
-- 
2.24.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ