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: <1450741676-5865-67-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:47:40 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 67/83] mn10300 dma_alloc_coherent(): switch to get_free_pages()

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 arch/mn10300/mm/dma-alloc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c
index 5f3132a4..ffcf771 100644
--- a/arch/mn10300/mm/dma-alloc.c
+++ b/arch/mn10300/mm/dma-alloc.c
@@ -23,17 +23,16 @@ static unsigned long pci_sram_allocated = 0xbc000000;
 void *dma_alloc_coherent(struct device *dev, size_t size,
 			 dma_addr_t *dma_handle, int gfp)
 {
-	unsigned long addr;
-	void *ret;
+	void *addr, *ret;
 
 	pr_debug("dma_alloc_coherent(%s,%zu,%x)\n",
 		 dev ? dev_name(dev) : "?", size, gfp);
 
 	if (0xbe000000 - pci_sram_allocated >= size) {
 		size = (size + 255) & ~255;
-		addr = pci_sram_allocated;
+		addr = (void *)pci_sram_allocated;
 		pci_sram_allocated += size;
-		ret = (void *) addr;
+		ret = addr;
 		goto done;
 	}
 
@@ -43,21 +42,21 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
 	if (dev == NULL || dev->coherent_dma_mask < 0xffffffff)
 		gfp |= GFP_DMA;
 
-	addr = __get_free_pages(gfp, get_order(size));
+	addr = get_free_pages(gfp, get_order(size));
 	if (!addr)
 		return NULL;
 
 	/* map the coherent memory through the uncached memory window */
-	ret = (void *) (addr | 0x20000000);
+	ret = (void *) ((unsigned long)addr | 0x20000000);
 
 	/* fill the memory with obvious rubbish */
-	memset((void *) addr, 0xfb, size);
+	memset(addr, 0xfb, size);
 
 	/* write back and evict all cache lines covering this region */
-	mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE);
+	mn10300_dcache_flush_inv_range2(virt_to_phys(addr), PAGE_SIZE);
 
 done:
-	*dma_handle = virt_to_bus((void *) addr);
+	*dma_handle = virt_to_bus(addr);
 	printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle);
 	return ret;
 }
-- 
2.1.4

--
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