lkml.org 
[lkml]   [2019]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH v3 4/4] x86/uaccess: Fix implicit cast of __user pointer
    From
    The first two arguments of __user_atomic_cmpxchg_inatomic() are:

    - `uval` is a kernel pointer into which the old value should be stored
    - `ptr` is the user pointer on which the cmpxchg should operate

    This means that casting `uval` to `__typeof__(ptr)` is wrong. Since `uval`
    is only used once inside the macro, just get rid of __uval and use `(uval)`
    directly.

    Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
    Signed-off-by: Jann Horn <jannh@google.com>
    ---
    arch/x86/include/asm/uaccess.h | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
    index 1954dd5552a2..a21f2a2f17bf 100644
    --- a/arch/x86/include/asm/uaccess.h
    +++ b/arch/x86/include/asm/uaccess.h
    @@ -585,7 +585,6 @@ extern void __cmpxchg_wrong_size(void)
    #define __user_atomic_cmpxchg_inatomic(uval, ptr, old, new, size) \
    ({ \
    int __ret = 0; \
    - __typeof__(ptr) __uval = (uval); \
    __typeof__(*(ptr)) __old = (old); \
    __typeof__(*(ptr)) __new = (new); \
    __uaccess_begin_nospec(); \
    @@ -661,7 +660,7 @@ extern void __cmpxchg_wrong_size(void)
    __cmpxchg_wrong_size(); \
    } \
    __uaccess_end(); \
    - *__uval = __old; \
    + *(uval) = __old; \
    __ret; \
    })

    --
    2.21.0.392.gf8f6787159e-goog
    \
     
     \ /
      Last update: 2019-03-29 22:51    [W:2.335 / U:0.872 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site