lkml.org 
[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] scatterlist: add a warning if sg_virt() is used on highmem pages
Date
sg_virt() on highmem pages won't work. This WARN_ON() should catch some
that still try.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/scatterlist.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 4bd6c06..4d4adab 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -198,6 +198,9 @@ static inline dma_addr_t sg_phys(struct scatterlist *sg)
**/
static inline void *sg_virt(struct scatterlist *sg)
{
+#ifdef CONFIG_DEBUG_SG
+ WARN_ON(PageHighMem(sg_page(sg)));
+#endif
return page_address(sg_page(sg)) + sg->offset;
}

--
1.7.10.4


\
 
 \ /
  Last update: 2012-12-05 13:21    [W:0.159 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site