Re: [PATCH][next] Bluetooth: hci_event: Use struct_size() helper

From: Marcel Holtmann
Date: Mon Feb 18 2019 - 08:00:42 EST


Hi Gustavo,

> 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, change the following form:
>
> sizeof(*ev) + ev->num_hndl * sizeof(struct hci_comp_pkts_info)
>
> to :
>
> struct_size(ev, handles, ev->num_hndl)
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>
> ---
> net/bluetooth/hci_event.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel