]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: mgmt: Use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 25 Feb 2019 19:11:37 +0000 (13:11 -0600)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Feb 2019 08:46:49 +0000 (09:46 +0100)
commit6a2abb96077d1fdcd55fdbe034cb4396fe417514
tree67b51137a85bfc9ee5efd93d282e72b53f1d9013
parent8fd33003260ffe3b2600794df1f68155aadd5655
Bluetooth: mgmt: Use struct_size() helper

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@embeddedor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c