Re: net/netfilter/nft_synproxy.c:51:40: sparse: sparse: cast to non-scalar
From: Florian Westphal
Date: Mon Mar 09 2026 - 17:46:35 EST
Fernando Fernandez Mancera <fmancera@xxxxxxx> wrote:
> Hi,
>
> Is this a false positive? nf_synproxy_info struct is smaller than the
> word size and therefore READ_ONCE() should be fine. I guess I can use
> READ_ONCE() for every struct field.
>
> What do you think Florian?
We shouldn't do per-field accesses here, but one, single READ so
the datapath sees all new fields or the old ones, and no mix of the
two (albeit that would be harmless here).
Can you experiment with a cast to u32 to get rid if the warning?
That said, we have so many sparse warnings that getting rid of this
warning isn't high-prio, I think the code is fine as-is.