[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <A80DE670-A0CB-49DE-9852-25B9F2AE6577@holtmann.org>
Date: Tue, 26 Feb 2019 09:48:41 +0100
From: Marcel Holtmann <marcel@...tmann.org>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: Johan Hedberg <johan.hedberg@...il.com>,
"David S. Miller" <davem@...emloft.net>,
"open list:BLUETOOTH DRIVERS" <linux-bluetooth@...r.kernel.org>,
netdev <netdev@...r.kernel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] Bluetooth: mgmt: Use struct_size() helper
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(*rp) + (sizeof(rp->entry[0]) * count);
>
> to :
>
> struct_size(rp, entry, count)
>
> Notice that, in this case, variable rp_len is not necessary, hence
> it is removed.
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
> ---
> net/bluetooth/mgmt.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Powered by blists - more mailing lists