aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVegard Nossum <vegard.nossum@gmail.com>2008-07-20 04:44:54 -0400
committerVegard Nossum <vegard.nossum@gmail.com>2009-06-15 06:40:05 -0400
commitd7002857dee6e9a3ce1f78d23f37caba106b29c5 (patch)
tree64453eb81be8409937a6daf207442cf5021e3b5e
parent2dff440525f8faba8836e9f05297b76f23b4af30 (diff)
kmemcheck: add DMA hooks
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>
-rw-r--r--arch/x86/include/asm/dma-mapping.h2
-rw-r--r--include/linux/kmemcheck.h16
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index f82fdc412c64..d57d0c1857bc 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -6,6 +6,7 @@
6 * Documentation/DMA-API.txt for documentation. 6 * Documentation/DMA-API.txt for documentation.
7 */ 7 */
8 8
9#include <linux/kmemcheck.h>
9#include <linux/scatterlist.h> 10#include <linux/scatterlist.h>
10#include <linux/dma-debug.h> 11#include <linux/dma-debug.h>
11#include <linux/dma-attrs.h> 12#include <linux/dma-attrs.h>
@@ -60,6 +61,7 @@ dma_map_single(struct device *hwdev, void *ptr, size_t size,
60 dma_addr_t addr; 61 dma_addr_t addr;
61 62
62 BUG_ON(!valid_dma_direction(dir)); 63 BUG_ON(!valid_dma_direction(dir));
64 kmemcheck_mark_initialized(ptr, size);
63 addr = ops->map_page(hwdev, virt_to_page(ptr), 65 addr = ops->map_page(hwdev, virt_to_page(ptr),
64 (unsigned long)ptr & ~PAGE_MASK, size, 66 (unsigned long)ptr & ~PAGE_MASK, size,
65 dir, NULL); 67 dir, NULL);
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 5b65f4ebeadf..71f21ae33d1d 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -59,6 +59,22 @@ static inline bool kmemcheck_page_is_tracked(struct page *p)
59{ 59{
60 return false; 60 return false;
61} 61}
62
63static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
64{
65}
66
67static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
68{
69}
70
71static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
72{
73}
74
75static inline void kmemcheck_mark_freed(void *address, unsigned int n)
76{
77}
62#endif /* CONFIG_KMEMCHECK */ 78#endif /* CONFIG_KMEMCHECK */
63 79
64#endif /* LINUX_KMEMCHECK_H */ 80#endif /* LINUX_KMEMCHECK_H */