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>] [day] [month] [year] [list]
Message-ID: <BD79186B4FD85F4B8E60E381CAEE190901FB0FCA@mi8nycmail19.Mi8.com>
Date:	Thu, 10 Dec 2009 20:44:32 -0500
From:	"H Hartley Sweeten" <hartleys@...ionengravers.com>
To:	"kernel list" <linux-kernel@...r.kernel.org>
Cc:	<haavard.skinnemoen@...el.com>
Subject: [PATCH] dw_dmac.c: remove unnecessary memset() and use resource_size()

The memset() is unnecessary since kzalloc already zero's the memory.

The platform resource is properly defined so use resource_size()
instead of the magic number DW_REGLEN for the ioremap() and
{request/release}_mem_region().

Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.com>
Cc: Haavard Skinnemoen <haavard.skinnemoen@...el.com>

---

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 2eea823..97ea99a 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1265,14 +1265,13 @@ static int __init dw_probe(struct platform_device *pdev)
 	if (!dw)
 		return -ENOMEM;
 
-	if (!request_mem_region(io->start, DW_REGLEN, pdev->dev.driver->name)) {
+	if (!request_mem_region(io->start, resource_size(io),
+				pdev->dev.driver->name)) {
 		err = -EBUSY;
 		goto err_kfree;
 	}
 
-	memset(dw, 0, sizeof *dw);
-
-	dw->regs = ioremap(io->start, DW_REGLEN);
+	dw->regs = ioremap(io->start, resource_size(io));
 	if (!dw->regs) {
 		err = -ENOMEM;
 		goto err_release_r;
@@ -1392,7 +1391,7 @@ static int __exit dw_remove(struct platform_device *pdev)
 	dw->regs = NULL;
 
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(io->start, DW_REGLEN);
+	release_mem_region(io->start, resource_size(io));
 
 	kfree(dw);
  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ