Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac4e97ab authored by Rusty Russell's avatar Rusty Russell Committed by Jens Axboe
Browse files

scatterlist: sg_set_buf() argument must be in linear mapping



Add a check behind CONFIG_DEBUG_SG to verify this.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4997b72e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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));
}