Re: [PATCH net-next v1] net: sched: cls_u32: Avoid memcpy() false-positive warning in u32_init_knode()
From: Simon Horman
Date: Mon Mar 09 2026 - 08:12:58 EST
On Thu, Mar 05, 2026 at 03:33:43PM +0800, Jiayuan Chen wrote:
> From: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
>
> Syzbot reported a warning in u32_init_knode() [1].
>
> Similar to commit 7cba18332e36 ("net: sched: cls_u32: Avoid memcpy()
> false-positive warning") which addressed the same issue in u32_change(),
> use unsafe_memcpy() in u32_init_knode() to work around the compiler's
> inability to see into composite flexible array structs.
>
> This silences the false-positive reported by syzbot:
>
> memcpy: detected field-spanning write (size 32) of single field
> "&new->sel" at net/sched/cls_u32.c:855 (size 16)
>
> Since the memory is correctly allocated with kzalloc_flex() using
> s->nkeys, this is purely a false positive and does not need a Fixes tag.
>
> [1] https://syzkaller.appspot.com/bug?extid=d5ace703ed883df56e42
>
> Reported-by: syzbot+d5ace703ed883df56e42@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/all/69a811b9.a70a0220.b118c.0019.GAE@xxxxxxxxxx/T/
> Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxxx>
> Made-with: Cursor
FWIIW, Made-with is a new tag to me, I would have expected Assisted-by.
That notwithstanding, this looks good to me.
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>