Re: [PATCH net-next] wimax/i2400m: use struct_size() helper

From: David Miller
Date: Sat May 04 2019 - 00:06:42 EST


From: "Gustavo A. R. Silva" <gustavo@xxxxxxxxxxxxxx>
Date: Tue, 30 Apr 2019 22:27:32 -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(*tx_msg) + le16_to_cpu(tx_msg->num_pls) * sizeof(tx_msg->pld[0]);
>
> with:
>
> struct_size(tx_msg, pld, le16_to_cpu(tx_msg->num_pls));
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>

Applied.