lib/dma-debug: fix bucket_find_contain()
authorSebastian Ott <[email protected]>
Thu, 16 Apr 2015 19:43:25 +0000 (12:43 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Apr 2015 13:03:54 +0000 (09:03 -0400)
bucket_find_contain() will search the bucket list for a dma_debug_entry.
When the entry isn't found it needs to search other buckets too, since
only the start address of a dma range is hashed (which might be in a
different bucket).

A copy of the dma_debug_entry is used to get the previous hash bucket
but when its list is searched the original dma_debug_entry is to be used
not its modified copy.

This fixes false "device driver tries to sync DMA memory it has not allocated"
warnings.

Signed-off-by: Sebastian Ott <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Horia Geanta <[email protected]>
Cc: Jiri Kosina <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/dma-debug.c

index 9722bd2dbc9bd5782e867c72f8b6893f9ab2c5ab..ae4b65e17e6486c7431fdc39335eab4cb15a0539 100644 (file)
@@ -361,7 +361,7 @@ static struct dma_debug_entry *bucket_find_contain(struct hash_bucket **bucket,
        unsigned int range = 0;
 
        while (range <= max_range) {
-               entry = __hash_bucket_find(*bucket, &index, containing_match);
+               entry = __hash_bucket_find(*bucket, ref, containing_match);
 
                if (entry)
                        return entry;