]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
fix unsafe_put_user()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 21 May 2017 17:08:42 +0000 (13:08 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 21 May 2017 17:09:57 +0000 (13:09 -0400)
__put_user_size() relies upon its first argument having the same type as what
the second one points to; the only other user makes sure of that and
unsafe_put_user() should do the same.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/x86/include/asm/uaccess.h

index 68766b276d9eea540ef6aad3f43d4b52e6b8bf54..d9668c3beb5b4943de4f9610454890ceaa5b1e39 100644 (file)
@@ -703,7 +703,7 @@ extern struct movsl_mask {
 #define unsafe_put_user(x, ptr, err_label)                                     \
 do {                                                                           \
        int __pu_err;                                                           \
-       __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT);         \
+       __put_user_size((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT);             \
        if (unlikely(__pu_err)) goto err_label;                                 \
 } while (0)