Commit 4374b2ad authored by David Mosberger's avatar David Mosberger Committed by Tony Luck

[IA64] contig.c: fix bug in DMA-zone initialization

Below is a patch that fixes count_dma_pages().  Without this fix, only
memory areas entirely below MAX_DMA_ADDRESS are counted as DMA-pages.
While it doesn't really make a difference in practice (MAX_DMA_ADDRESS
is equal to ~0UL on zx1), it's clearly not what was intended to be
there.  I found the bug only because I briefly experimented with
lowering MAX_DMA_ADDRESS.

Tony> The discontig.c version of this code already gets this right.
Signed-off-by: default avatarDavid Mosberger-Tang <davidm@hpl.hp.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 7714fd6c
......@@ -214,8 +214,8 @@ count_dma_pages (u64 start, u64 end, void *arg)
{
unsigned long *count = arg;
if (end <= MAX_DMA_ADDRESS)
*count += (end - start) >> PAGE_SHIFT;
if (start < MAX_DMA_ADDRESS)
*count += (min(end, MAX_DMA_ADDRESS) - start) >> PAGE_SHIFT;
return 0;
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment