提交 ac4e97ab 编写于 作者: R Rusty Russell 提交者: Jens Axboe

scatterlist: sg_set_buf() argument must be in linear mapping

Add a check behind CONFIG_DEBUG_SG to verify this.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 4997b72e
...@@ -111,6 +111,9 @@ static inline struct page *sg_page(struct scatterlist *sg) ...@@ -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, static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
unsigned int buflen) 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)); sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册