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-next>] [day] [month] [year] [list]
Date:	Tue, 20 Jan 2009 21:48:00 +0000
From:	Adrian McMenamin <lkmladrian@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	Paul Mundt <lethal@...ux-sh.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-sh <linux-sh@...r.kernel.org>, penberg@...helsinki.fi,
	dbaryshkov@...il.com, penguin-kernel@...ove.sakura.ne.jp,
	Adrian McMenamin <adrian@...golddream.dyndns.info>
Subject: [PATCH] dma: fix up broken comparison in dma_alloc_from_coherent

Currently this code compares a size in bytes with a size in pages.
This patch makes both sides of the comparison bytes.


Previous code (introduced in commit
58c6d3dfe436eb8cfb451981d8fdc9044eaf42da) brakes Dreamcast, this code
has been tested and works on the Dreamcast.

Signed-off-by: Adrian McMenamin <adrian@...en.demon.co.uk>
---

diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c
index 0387074..8114dd7 100644
--- a/kernel/dma-coherent.c
+++ b/kernel/dma-coherent.c
@@ -112,13 +112,13 @@ int dma_alloc_from_coherent(struct device *dev,
ssize_t size,
 	struct dma_coherent_mem *mem;
 	int order = get_order(size);
 	int pageno;

 	if (!dev)
 		return 0;
 	mem = dev->dma_mem;
 	if (!mem)
 		return 0;
-	if (unlikely(size > mem->size))
+	if (unlikely(size > mem->size << PAGE_SHIFT))
  		return 0;

 	pageno = bitmap_find_free_region(mem->bitmap, mem->size, order);
--
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