diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2007-05-08 03:31:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:14 -0400 |
commit | b247e8aaf2837715d31eb25828fa8b4eb0a659cd (patch) | |
tree | b796caad363353128d47da9beefb9df10014ae64 /arch | |
parent | f19b121e21c1b032f6c612d2b9b499151f7b661b (diff) |
dma_declare_coherent_memory wrong allocation
dma_declare_coherent_memory() allocates a bitmap 1 bit per page, it
calculates the bitmap size based on size of long, but allocates bytes...
Thanks to James Bottomley for clarifications and corrections.
Signed-off-by: G. Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/cris/arch-v32/drivers/pci/dma.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/pci-dma.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c index 70d3bf0c92e8..832fc63504d4 100644 --- a/arch/cris/arch-v32/drivers/pci/dma.c +++ b/arch/cris/arch-v32/drivers/pci/dma.c | |||
@@ -76,7 +76,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | |||
76 | { | 76 | { |
77 | void __iomem *mem_base; | 77 | void __iomem *mem_base; |
78 | int pages = size >> PAGE_SHIFT; | 78 | int pages = size >> PAGE_SHIFT; |
79 | int bitmap_size = (pages + 31)/32; | 79 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); |
80 | 80 | ||
81 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) | 81 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) |
82 | goto out; | 82 | goto out; |
diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c index 3ebcea033623..30b754f7cbec 100644 --- a/arch/i386/kernel/pci-dma.c +++ b/arch/i386/kernel/pci-dma.c | |||
@@ -77,7 +77,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | |||
77 | { | 77 | { |
78 | void __iomem *mem_base = NULL; | 78 | void __iomem *mem_base = NULL; |
79 | int pages = size >> PAGE_SHIFT; | 79 | int pages = size >> PAGE_SHIFT; |
80 | int bitmap_size = (pages + 31)/32; | 80 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); |
81 | 81 | ||
82 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) | 82 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) |
83 | goto out; | 83 | goto out; |