Re: 2.6.7-mm7

From: James Bottomley
Date: Fri Jul 09 2004 - 17:27:25 EST


On Fri, 2004-07-09 at 17:14, Andrew Morton wrote:
> btw, James, I'm unable to convince myself that
> dma_mark_declared_memory_occupied() reserves enough pages if device_addr is
> not page-aligned. Could you double-check that? If all callers are
> expected to use a page-aligned address then a BUG_ON might be appropriate.
> Or a comment.

Oh, you mean when addr isn't page aligned and size causes it just to
span a page, like addr = 0xfff, size=2?

You're right, it doesn't. How about the attached

James

===== arch/i386/kernel/pci-dma.c 1.13 vs edited =====
--- 1.13/arch/i386/kernel/pci-dma.c 2004-06-30 21:37:55 -05:00
+++ edited/arch/i386/kernel/pci-dma.c 2004-07-09 17:20:14 -05:00
@@ -131,7 +131,7 @@
dma_addr_t device_addr, size_t size)
{
struct dma_coherent_mem *mem = dev->dma_mem;
- int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ int pages = (size + (addr & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
int pos, err;

if (!mem)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/