Hi Dave On Tue, 25 Aug 2026 at 23:06, Dave Hansen <[email protected]> wrote: > > On 8/25/26 13:02, Ricardo Ribalda wrote: > > 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 * > > Could we beef up the changelog here a bit, please? > > What _is_ the invalid casting? > > What is the fix? > > Why does it work?
Something like this would be better? I will send a v2 if there are no more comments. Recent versions of smatch preserved the address space qualifiers with typeof()[1]. This fix has discovered an invalid casting in put_user. put_user is using a casting with __typeof__(*(ptr)), which keeps the qualifiers (__user), instead it should use the macro TYPEOF_UNQUAL() that will use __typeof_unqual__ where the compiler supports it. __typeof_unqual__ copies the type but not the qualifiers. 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 -- Ricardo Ribalda

