Re: [PATCH 2/2] x86/uaccess: Fix casting in put_user

From: Dave Hansen

Date: Tue Aug 25 2026 - 18:38:21 EST


On 8/25/26 14:15, Ricardo Ribalda wrote:
>
> 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.

Oh, that's funny. I was assuming it was the 'const' causing the problem.
But I guess it makes sense that sparse would uniquely care about __user.

So the problem is that it tries to create a __user *integer*, which
makes no sense? Seems like we could just say that, too.