diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-09-28 09:55:00 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-09-28 11:18:49 -0400 |
commit | 13465c0aeb9c56a4e4799f25aeff41d05f8a3fab (patch) | |
tree | 167344caddcc8ec74f7be131ca8c8203ae16afb9 /net | |
parent | 2e430be386e97224c37086a5a48fa05a9f9b79bb (diff) |
Bluetooth: A2MP: Correct assoc_len size
Correct assoc_len and fix warning for x86-64 by using %zu specifier.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/a2mp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 61e657ae71e9..42788cdbb4fe 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -379,12 +379,15 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, | |||
379 | struct hci_dev *hdev; | 379 | struct hci_dev *hdev; |
380 | struct amp_ctrl *ctrl; | 380 | struct amp_ctrl *ctrl; |
381 | struct hci_conn *hcon; | 381 | struct hci_conn *hcon; |
382 | size_t assoc_len; | ||
382 | 383 | ||
383 | if (len < sizeof(*rsp)) | 384 | if (len < sizeof(*rsp)) |
384 | return -EINVAL; | 385 | return -EINVAL; |
385 | 386 | ||
386 | BT_DBG("id %d status 0x%2.2x assoc len %lu", rsp->id, rsp->status, | 387 | assoc_len = len - sizeof(*rsp); |
387 | len - sizeof(*rsp)); | 388 | |
389 | BT_DBG("id %d status 0x%2.2x assoc len %zu", rsp->id, rsp->status, | ||
390 | assoc_len); | ||
388 | 391 | ||
389 | if (rsp->status) | 392 | if (rsp->status) |
390 | return -EINVAL; | 393 | return -EINVAL; |
@@ -392,7 +395,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, | |||
392 | /* Save remote ASSOC data */ | 395 | /* Save remote ASSOC data */ |
393 | ctrl = amp_ctrl_lookup(mgr, rsp->id); | 396 | ctrl = amp_ctrl_lookup(mgr, rsp->id); |
394 | if (ctrl) { | 397 | if (ctrl) { |
395 | u8 *assoc, assoc_len = len - sizeof(*rsp); | 398 | u8 *assoc; |
396 | 399 | ||
397 | assoc = kzalloc(assoc_len, GFP_KERNEL); | 400 | assoc = kzalloc(assoc_len, GFP_KERNEL); |
398 | if (!assoc) { | 401 | if (!assoc) { |
@@ -466,7 +469,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, | |||
466 | } | 469 | } |
467 | 470 | ||
468 | if (ctrl) { | 471 | if (ctrl) { |
469 | u8 *assoc, assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); | 472 | size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); |
473 | u8 *assoc; | ||
470 | 474 | ||
471 | ctrl->id = rsp.remote_id; | 475 | ctrl->id = rsp.remote_id; |
472 | 476 | ||