diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-07-21 10:50:06 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-21 12:59:38 +0200 |
commit | 27f70f3e628c82362def60eb0af79d2129a51da2 (patch) | |
tree | 30789593d0d8af060492f8dc2a1994f4b41032bb /net/bluetooth/l2cap_core.c | |
parent | 0a961a440d693f0f74d3185728b13b8a11fc5860 (diff) | |
download | linux-27f70f3e628c82362def60eb0af79d2129a51da2.tar.gz linux-27f70f3e628c82362def60eb0af79d2129a51da2.tar.bz2 linux-27f70f3e628c82362def60eb0af79d2129a51da2.zip |
Bluetooth: Prefer sizeof(*ptr) when allocating memory
It's safer practice to use sizeof(*ptr) instead of sizeof(ptr_type) when
allocating memory in case the type changes. This also fixes the
following style of warnings from static analyzers:
CHECK: Prefer kzalloc(sizeof(*ie)...) over kzalloc(sizeof(struct inquiry_entry)...)
+ ie = kzalloc(sizeof(struct inquiry_entry), GFP_KERNEL);
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index f3fb61c9f96f..46547b920f88 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -6985,7 +6985,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) if (!hchan) return NULL; - conn = kzalloc(sizeof(struct l2cap_conn), GFP_KERNEL); + conn = kzalloc(sizeof(*conn), GFP_KERNEL); if (!conn) { hci_chan_del(hchan); return NULL; |