kernel_optimize_test/net/bluetooth
Gustavo A. R. Silva 3c97ce1f86 Bluetooth: a2mp: Use struct_size() helper
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = alloc(size, GFP_KERNEL)

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

size = struct_size(instance, entry, count);
instance = alloc(size, GFP_KERNEL)

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>
2019-02-18 14:01:59 +01:00
..
bnep Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-25 12:48:22 -07:00
cmtp Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-25 12:48:22 -07:00
hidp Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-10-25 12:48:22 -07:00
rfcomm Bluetooth: Mark expected switch fall-throughs 2019-01-23 18:27:16 +01:00
6lowpan.c Bluetooth: 6lowpan: Fix debugfs_simple_attr.cocci warnings 2019-01-22 09:51:19 +01:00
a2mp.c Bluetooth: a2mp: Use struct_size() helper 2019-02-18 14:01:59 +01:00
a2mp.h
af_bluetooth.c Bluetooth: Fix locking in bt_accept_enqueue() for BH context 2019-01-22 09:51:20 +01:00
amp.c Bluetooth: Use bt_dev_err and bt_dev_info when possible 2017-10-30 12:25:45 +02:00
amp.h
ecdh_helper.c Bluetooth: let the crypto subsystem generate the ecc privkey 2017-10-06 20:35:47 +02:00
ecdh_helper.h Bluetooth: let the crypto subsystem generate the ecc privkey 2017-10-06 20:35:47 +02:00
hci_conn.c Bluetooth: Implement Set ADV set random address 2018-07-30 13:44:53 +02:00
hci_core.c Bluetooth: make hw_err static, reduces object code size 2019-01-25 08:53:58 +01:00
hci_debugfs.c Bluetooth: Store Resolv list size 2018-07-06 12:40:08 +02:00
hci_debugfs.h
hci_event.c Bluetooth: hci_event: Use struct_size() helper 2019-02-18 14:00:09 +01:00
hci_request.c Bluetooth: clean an indentation issue, remove extraneous space 2018-12-19 00:44:01 +01:00
hci_request.h Bluetooth: Implement Set ADV set random address 2018-07-30 13:44:53 +02:00
hci_sock.c Bluetooth: Fix decrementing reference count twice in releasing socket 2019-02-04 15:43:46 +01:00
hci_sysfs.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-04 09:26:51 +09:00
Kconfig Revert "Bluetooth: Add option for disabling legacy ioctl interfaces" 2017-09-28 13:20:32 -07:00
l2cap_core.c Bluetooth: Mark expected switch fall-throughs 2019-01-23 18:27:16 +01:00
l2cap_sock.c Bluetooth: Fix locking in bt_accept_enqueue() for BH context 2019-01-22 09:51:20 +01:00
leds.c leds: triggers: let struct led_trigger::activate() return an error code 2018-07-05 23:21:10 +02:00
leds.h
lib.c Bluetooth: make baswap src const 2017-09-01 22:49:47 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mgmt_util.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
mgmt_util.h
mgmt.c Bluetooth: SMP: fix crash in unpairing 2018-09-26 12:39:32 +03:00
sco.c Bluetooth: Fix locking in bt_accept_enqueue() for BH context 2019-01-22 09:51:20 +01:00
selftest.c Bluetooth: Fix compiler warning with selftest duration calculation 2017-10-06 21:49:13 +03:00
selftest.h
smp.c crypto: drop mask=CRYPTO_ALG_ASYNC from 'shash' tfm allocations 2018-11-20 14:26:55 +08:00
smp.h Bluetooth: SMP: fix crash in unpairing 2018-09-26 12:39:32 +03:00