[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190504.000545.1402535421214277538.davem@davemloft.net>
Date: Sat, 04 May 2019 00:05:45 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: gustavo@...eddedor.com
Cc: inaky.perez-gonzalez@...el.com, linux-wimax@...el.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] wimax/i2400m: use struct_size() helper
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
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@...eddedor.com>
Applied.
Powered by blists - more mailing lists