Commit 9b5cab31 authored by Vegard Nossum's avatar Vegard Nossum

kmemcheck: add hooks for page- and sg-dma-mappings

This is needed for page allocator support to prevent false positives
when accessing pages which are dma-mapped.

[rebased for mainline inclusion]
Signed-off-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
parent 9e730237
...@@ -89,8 +89,12 @@ dma_map_sg(struct device *hwdev, struct scatterlist *sg, ...@@ -89,8 +89,12 @@ dma_map_sg(struct device *hwdev, struct scatterlist *sg,
{ {
struct dma_map_ops *ops = get_dma_ops(hwdev); struct dma_map_ops *ops = get_dma_ops(hwdev);
int ents; int ents;
struct scatterlist *s;
int i;
BUG_ON(!valid_dma_direction(dir)); BUG_ON(!valid_dma_direction(dir));
for_each_sg(sg, s, nents, i)
kmemcheck_mark_initialized(sg_virt(s), s->length);
ents = ops->map_sg(hwdev, sg, nents, dir, NULL); ents = ops->map_sg(hwdev, sg, nents, dir, NULL);
debug_dma_map_sg(hwdev, sg, nents, ents, dir); debug_dma_map_sg(hwdev, sg, nents, ents, dir);
...@@ -202,6 +206,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, ...@@ -202,6 +206,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
dma_addr_t addr; dma_addr_t addr;
BUG_ON(!valid_dma_direction(dir)); BUG_ON(!valid_dma_direction(dir));
kmemcheck_mark_initialized(page_address(page) + offset, size);
addr = ops->map_page(dev, page, offset, size, dir, NULL); addr = ops->map_page(dev, page, offset, size, dir, NULL);
debug_dma_map_page(dev, page, offset, size, dir, addr, false); debug_dma_map_page(dev, page, offset, size, dir, addr, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment