Commit 13465c0a authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo Padovan

Bluetooth: A2MP: Correct assoc_len size

Correct assoc_len and fix warning for x86-64 by using %zu specifier.
Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 2e430be3
...@@ -379,12 +379,15 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -379,12 +379,15 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
struct hci_dev *hdev; struct hci_dev *hdev;
struct amp_ctrl *ctrl; struct amp_ctrl *ctrl;
struct hci_conn *hcon; struct hci_conn *hcon;
size_t assoc_len;
if (len < sizeof(*rsp)) if (len < sizeof(*rsp))
return -EINVAL; return -EINVAL;
BT_DBG("id %d status 0x%2.2x assoc len %lu", rsp->id, rsp->status, assoc_len = len - sizeof(*rsp);
len - sizeof(*rsp));
BT_DBG("id %d status 0x%2.2x assoc len %zu", rsp->id, rsp->status,
assoc_len);
if (rsp->status) if (rsp->status)
return -EINVAL; return -EINVAL;
...@@ -392,7 +395,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -392,7 +395,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
/* Save remote ASSOC data */ /* Save remote ASSOC data */
ctrl = amp_ctrl_lookup(mgr, rsp->id); ctrl = amp_ctrl_lookup(mgr, rsp->id);
if (ctrl) { if (ctrl) {
u8 *assoc, assoc_len = len - sizeof(*rsp); u8 *assoc;
assoc = kzalloc(assoc_len, GFP_KERNEL); assoc = kzalloc(assoc_len, GFP_KERNEL);
if (!assoc) { if (!assoc) {
...@@ -466,7 +469,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, ...@@ -466,7 +469,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
} }
if (ctrl) { if (ctrl) {
u8 *assoc, assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
u8 *assoc;
ctrl->id = rsp.remote_id; ctrl->id = rsp.remote_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment