]> git.ipfire.org Git - thirdparty/linux.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)
commit4a67e5d4adbf3b419f17924322f468ac5cb8c14f
tree67b51137a85bfc9ee5efd93d282e72b53f1d9013
parentc14f7e1efcbf744c49fcb44a121112c54d2c5330
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