@@ -198,6 +198,9 @@ static inline dma_addr_t sg_phys(struct scatterlist *sg)
static inline void *sg_virt(struct scatterlist *sg)
return page_address(sg_page(sg)) + sg->offset;
Why won't it work? page_address() will search the kmap table and will
search for the page. If the caller had previously kmapped that page,
all is well. If the caller has failed to kmap the page, sg_virt() will
return a nearly-null pointer and presumably someone will later go oops.