Re: [PATCH net-next] net: sched: cls_u32: use struct_size() helper
From: David Miller
Date: Sat May 04 2019 - 00:47:45 EST
From: "Gustavo A. R. Silva" <gustavo@xxxxxxxxxxxxxx>
Date: Wed, 1 May 2019 11:23:15 -0500
> Make use of the struct_size() helper instead of an open-coded version
> in order to avoid any potential type mistakes, in particular in the
> context in which this code is being used.
> So, replace code of the following form:
> sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)
> struct_size(s, keys, s->nkeys)
> This code was detected with the help of Coccinelle.
> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>