Recent versions of smatch preserved the address space qualifiers with typeof()[1].
This fix has discovered an invalid casting in put_user. This patch fixes tens of smatch errors like the following: drivers/media/usb/uvc/uvc_v4l2.c:1112:13: warning: incorrect type in argument 2 (different address spaces) drivers/media/usb/uvc/uvc_v4l2.c:1112:13: expected void const *from drivers/media/usb/uvc/uvc_v4l2.c:1112:13: got unsigned int __user * [1] https://github.com/error27/smatch/commit/e53027a4e816a772403baafa83c09e4a94c1cb8f Suggested-by: Dan Carpenter <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> --- arch/x86/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 3a0dd3c2b233..4e576c0b9131 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -172,7 +172,7 @@ extern void __put_user_nocheck_8(void); int __ret_pu; \ void __user *__ptr_pu; \ register __typeof__(*(ptr)) __val_pu asm("%"_ASM_AX); \ - __typeof__(*(ptr)) __x = (x); /* eval x once */ \ + TYPEOF_UNQUAL(*(ptr)) __x = (x); /* eval x once */ \ __typeof__(ptr) __ptr = (ptr); /* eval ptr once */ \ __chk_user_ptr(__ptr); \ __ptr_pu = __ptr; \ @@ -231,7 +231,7 @@ extern void __put_user_nocheck_8(void); #define __put_user_size(x, ptr, size, label) \ do { \ - __typeof__(*(ptr)) __x = (x); /* eval x once */ \ + TYPEOF_UNQUAL(*(ptr)) __x = (x); /* eval x once */ \ __typeof__(ptr) __ptr = (ptr); /* eval ptr once */ \ __chk_user_ptr(__ptr); \ switch (size) { \ -- 2.55.0.897.gb25b4bd76c-goog

