Re: include/net/sock.h:2100:16: sparse: sparse: cast to non-scalar

From: Peter Zijlstra

Date: Tue Jan 13 2026 - 10:27:09 EST


On Mon, Jan 12, 2026 at 07:30:19PM +0000, Al Viro wrote:

> Sure, but what does that have to do with the final cast in there? Note
> that generic __READ_ONCE() ends up with __unqual_scalar_typeof(x) for the
> type of result and it seems to be working fine.
>
> Why would the same type of result be a problem for alpha? Sure, we need
> a barrier there, so it can't be literal copy of generic __READ_ONCE(),
> but what's the problem with using
>
> #define __READ_ONCE(x) \
> ({ \
> __unqual_scalar_typeof(x) __x = \
> (*(volatile typeof(__x) *)(&(x))); \
> mb(); \
> __x; \
> })
>
> there? What could possibly need those qualifiers added back to the result?
> It is, after all, an r-value, so...

Yeah, I'm not sure about the final cast, that was probably trying to add
'const' back.