lkml.org 
[lkml]   [2012]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] scatterlist: add a warning if sg_virt() is used on highmem pages
    On 12/05/2012 10:46 PM, Andrew Morton wrote:
    >> --- a/include/linux/scatterlist.h
    >> +++ b/include/linux/scatterlist.h
    >> @@ -198,6 +198,9 @@ static inline dma_addr_t sg_phys(struct scatterlist *sg)
    >> **/
    >> static inline void *sg_virt(struct scatterlist *sg)
    >> {
    >> +#ifdef CONFIG_DEBUG_SG
    >> + WARN_ON(PageHighMem(sg_page(sg)));
    >> +#endif
    >> 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.

    I missed that it will work for previously mapped page. If you think
    that an oops later is enough then okay, I drop this.

    Sebastian


    \
     
     \ /
      Last update: 2012-12-06 10:21    [W:3.594 / U:0.320 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site