Skip to content

Commit

Permalink
dma-debug: warn of unmapping an invalid dma address
Browse files Browse the repository at this point in the history
Impact: extend DMA-debug checks

Calling dma_unmap families against an invalid dma address should be a
bug.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Joerg Roedel <joerg.roedel@amd.com>
LKML-Reference: <20090319103743N.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
fujita authored and Ingo Molnar committed Mar 19, 2009
1 parent 84be58d commit 35d4095
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,11 @@ static void check_unmap(struct dma_debug_entry *ref)
struct hash_bucket *bucket;
unsigned long flags;

if (dma_mapping_error(ref->dev, ref->dev_addr))
if (dma_mapping_error(ref->dev, ref->dev_addr)) {
err_printk(ref->dev, NULL, "DMA-API: device driver tries "
"to free an invalid DMA memory address\n");
return;
}

bucket = get_hash_bucket(ref, &flags);
entry = hash_bucket_find(bucket, ref);
Expand Down

0 comments on commit 35d4095

Please sign in to comment.