]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
kmemcheck: add DMA hooks
authorVegard Nossum <vegard.nossum@gmail.com>
Sun, 20 Jul 2008 08:44:54 +0000 (10:44 +0200)
committerVegard Nossum <vegard.nossum@gmail.com>
Mon, 15 Jun 2009 10:40:05 +0000 (12:40 +0200)
This patch hooks into the DMA API to prevent the reporting of the
false positives that would otherwise be reported when memory is
accessed that is also used directly by devices.

[rebased for mainline inclusion]
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
arch/x86/include/asm/dma-mapping.h
include/linux/kmemcheck.h

index f82fdc412c64b9d3371fb1a9df65f38ba141bb52..d57d0c1857bcff13cdf7df27e4471abb561cbcd0 100644 (file)
@@ -6,6 +6,7 @@
  * Documentation/DMA-API.txt for documentation.
  */
 
+#include <linux/kmemcheck.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-debug.h>
 #include <linux/dma-attrs.h>
@@ -60,6 +61,7 @@ dma_map_single(struct device *hwdev, void *ptr, size_t size,
        dma_addr_t addr;
 
        BUG_ON(!valid_dma_direction(dir));
+       kmemcheck_mark_initialized(ptr, size);
        addr = ops->map_page(hwdev, virt_to_page(ptr),
                             (unsigned long)ptr & ~PAGE_MASK, size,
                             dir, NULL);
index 5b65f4ebeadfcac9a8f453a0da74b54640fc242e..71f21ae33d1df54002ae12f2b20ba8deddf7dacb 100644 (file)
@@ -59,6 +59,22 @@ static inline bool kmemcheck_page_is_tracked(struct page *p)
 {
        return false;
 }
+
+static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
+{
+}
+
+static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
+{
+}
+
+static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
+{
+}
+
+static inline void kmemcheck_mark_freed(void *address, unsigned int n)
+{
+}
 #endif /* CONFIG_KMEMCHECK */
 
 #endif /* LINUX_KMEMCHECK_H */