]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Prefer sizeof(*ptr) when allocating memory
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 21 Jul 2014 07:50:06 +0000 (10:50 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 21 Jul 2014 10:59:38 +0000 (12:59 +0200)
commitf8e0c9ec71aefbd00c5b655ca66b952926f7848a
tree30789593d0d8af060492f8dc2a1994f4b41032bb
parent9eeb73ec99ec4249f7c8ea34c995e72d7db5005f
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>
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c
net/bluetooth/l2cap_core.c