Calling dma_unmap families against an invalid dma address should be a
bug.
Signed-off-by: FUJITA Tomonori <[email protected]>
---
lib/dma-debug.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 9a350b4..f9e6d38 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -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);
--
1.6.0.6
Commit-ID: 35d40952dba7b0689a16bd1463fb7698f8dbe639
Gitweb: http://git.kernel.org/tip/35d40952dba7b0689a16bd1463fb7698f8dbe639
Author: FUJITA Tomonori <[email protected]>
AuthorDate: Thu, 19 Mar 2009 10:39:31 +0900
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 19 Mar 2009 08:39:48 +0100
dma-debug: warn of unmapping an invalid dma address
Impact: extend DMA-debug checks
Calling dma_unmap families against an invalid dma address should be a
bug.
Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: Joerg Roedel <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
lib/dma-debug.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 9a350b4..f9e6d38 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -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);