Skip to content

Commit

Permalink
scatterlist: sg_set_buf() argument must be in linear mapping
Browse files Browse the repository at this point in the history
Add a check behind CONFIG_DEBUG_SG to verify this.

Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
rustyrussell authored and axboe committed May 30, 2013
1 parent 4997b72 commit ac4e97a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/scatterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit ac4e97a

Please sign in to comment.