• Michael S. Tsirkin's avatar
    mm/gup_benchmark: handle gup failures · 09e35a4a
    Michael S. Tsirkin authored
    Patch series "mm/get_user_pages_fast fixes, cleanups", v2.
    
    Turns out get_user_pages_fast and __get_user_pages_fast return different
    values on error when given a single page: __get_user_pages_fast returns
    0.  get_user_pages_fast returns either 0 or an error.
    
    Callers of get_user_pages_fast expect an error so fix it up to return an
    error consistently.
    
    Stress the difference between get_user_pages_fast and
    __get_user_pages_fast to make sure callers aren't confused.
    
    This patch (of 3):
    
    __gup_benchmark_ioctl does not handle the case where get_user_pages_fast
    fails:
    
     - a negative return code will cause a buffer overrun
    
     - returning with partial success will cause use of uninitialized
       memory.
    
    [akpm@linux-foundation.org: simplification]
    Link: http://lkml.kernel.org/r/1522962072-182137-3-git-send-email-mst@redhat.com
    
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Cc: Kirill A. Shutemov <kirill.shutemov@linux.in...
    09e35a4a
gup_benchmark.c 2.05 KB