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]
Date:	Mon, 1 Jun 2009 16:32:55 +0100
From:	Ian Campbell <ian.campbell@...rix.com>
To:	<linux-kernel@...r.kernel.org>
CC:	Ian Campbell <ian.campbell@...rix.com>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Jeremy Fitzhardinge <jeremy@...p.org>, <x86@...nel.org>
Subject: [PATCH 03/11] x86: use dma_map_range when allocating PCI DMA memory

This function is intended to replaces is_buffer_dma_capable with a
more generic interface.

Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Cc: Jeremy Fitzhardinge <jeremy@...p.org>
Cc: x86@...nel.org
---
 arch/x86/kernel/pci-dma.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index f4c1b03..458b7b5 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -160,7 +160,6 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 {
 	unsigned long dma_mask;
 	struct page *page;
-	dma_addr_t addr;
 
 	dma_mask = dma_alloc_coherent_mask(dev, flag);
 
@@ -170,8 +169,7 @@ again:
 	if (!page)
 		return NULL;
 
-	addr = page_to_phys(page);
-	if (!is_buffer_dma_capable(dma_mask, addr, size)) {
+	if (!dma_map_range(dev, dma_mask, page_to_phys(page), size, dma_addr)) {
 		__free_pages(page, get_order(size));
 
 		if (dma_mask < DMA_BIT_MASK(32) && !(flag & GFP_DMA)) {
@@ -182,7 +180,6 @@ again:
 		return NULL;
 	}
 
-	*dma_addr = addr;
 	return page_address(page);
 }
 
-- 
1.5.6.5

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