diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-05-30 03:19:35 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-05-30 03:20:20 -0400 |
commit | ac4e97abce9b80c020e7113325f49e58b7b15e3f (patch) | |
tree | 6b1395a60b4e28a34f4e3693fbfb3df98008a20b /include | |
parent | 4997b72ee62930cb841d185398ea547d979789f4 (diff) |
scatterlist: sg_set_buf() argument must be in linear mapping
Add a check behind CONFIG_DEBUG_SG to verify this.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/scatterlist.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 5951e3f38878..26806775b11b 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -111,6 +111,9 @@ static inline struct page *sg_page(struct scatterlist *sg) | |||
111 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, | 111 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, |
112 | unsigned int buflen) | 112 | unsigned int buflen) |
113 | { | 113 | { |
114 | #ifdef CONFIG_DEBUG_SG | ||
115 | BUG_ON(!virt_addr_valid(buf)); | ||
116 | #endif | ||
114 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); | 117 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); |
115 | } | 118 | } |
116 | 119 | ||