From: Rusty Russell Date: Thu, 30 May 2013 07:19:35 +0000 (+0200) Subject: scatterlist: sg_set_buf() argument must be in linear mapping X-Git-Tag: upstream/snapshot3+hdmi~4937^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac4e97abce9b80c020e7113325f49e58b7b15e3f;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Jens Axboe --- diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 5951e3f..2680677 100644 --- a/include/linux/scatterlist.h +++ b/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)); }