Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nios2/uaccess: fix sparse errors

virtio wants to read bitwise types from userspace using get_user. At the
moment this triggers sparse errors, since the value is passed through an
integer.

Fix that up using __force.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Ley Foon Tan <lftan@altera.com>

+2 -2
+2 -2
arch/nios2/include/asm/uaccess.h
··· 168 168 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ 169 169 unsigned long __gu_val; \ 170 170 __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ 171 - (x) = (__typeof__(x))__gu_val; \ 171 + (x) = (__force __typeof__(x))__gu_val; \ 172 172 __gu_err; \ 173 173 }) 174 174 ··· 180 180 if (access_ok(VERIFY_READ, __gu_ptr, sizeof(*__gu_ptr))) \ 181 181 __get_user_common(__gu_val, sizeof(*__gu_ptr), \ 182 182 __gu_ptr, __gu_err); \ 183 - (x) = (__typeof__(x))__gu_val; \ 183 + (x) = (__force __typeof__(x))__gu_val; \ 184 184 __gu_err; \ 185 185 }) 186 186