浏览代码

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>
Rusty Russell 12 年之前
父节点
当前提交
ac4e97abce
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      include/linux/scatterlist.h

+ 3 - 0
include/linux/scatterlist.h

@@ -111,6 +111,9 @@ static inline struct page *sg_page(struct scatterlist *sg)
 static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
 			      unsigned int buflen)
 {
+#ifdef CONFIG_DEBUG_SG
+	BUG_ON(!virt_addr_valid(buf));
+#endif
 	sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
 }