aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 02827af1aef0..5e18d5a451f4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -439,7 +439,6 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
439{ 439{
440 u8 *ptr = data; 440 u8 *ptr = data;
441 u8 *uuids_start; 441 u8 *uuids_start;
442 u16 eir_len = 0;
443 struct bt_uuid *uuid; 442 struct bt_uuid *uuid;
444 size_t name_len; 443 size_t name_len;
445 444
@@ -458,7 +457,6 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
458 457
459 memcpy(ptr + 2, hdev->dev_name, name_len); 458 memcpy(ptr + 2, hdev->dev_name, name_len);
460 459
461 eir_len += (name_len + 2);
462 ptr += (name_len + 2); 460 ptr += (name_len + 2);
463 } 461 }
464 462
@@ -467,7 +465,6 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
467 ptr[1] = EIR_TX_POWER; 465 ptr[1] = EIR_TX_POWER;
468 ptr[2] = (u8) hdev->inq_tx_power; 466 ptr[2] = (u8) hdev->inq_tx_power;
469 467
470 eir_len += 3;
471 ptr += 3; 468 ptr += 3;
472 } 469 }
473 470
@@ -480,7 +477,6 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
480 put_unaligned_le16(hdev->devid_product, ptr + 6); 477 put_unaligned_le16(hdev->devid_product, ptr + 6);
481 put_unaligned_le16(hdev->devid_version, ptr + 8); 478 put_unaligned_le16(hdev->devid_version, ptr + 8);
482 479
483 eir_len += 10;
484 ptr += 10; 480 ptr += 10;
485 } 481 }
486 482
@@ -505,18 +501,16 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
505 uuids_start[0] = 1; 501 uuids_start[0] = 1;
506 uuids_start[1] = EIR_UUID16_ALL; 502 uuids_start[1] = EIR_UUID16_ALL;
507 ptr += 2; 503 ptr += 2;
508 eir_len += 2;
509 } 504 }
510 505
511 /* Stop if not enough space to put next UUID */ 506 /* Stop if not enough space to put next UUID */
512 if (eir_len + 2 + sizeof(u16) > HCI_MAX_EIR_LENGTH) { 507 if ((ptr - data) + 2 + sizeof(u16) > HCI_MAX_EIR_LENGTH) {
513 uuids_start[1] = EIR_UUID16_SOME; 508 uuids_start[1] = EIR_UUID16_SOME;
514 break; 509 break;
515 } 510 }
516 511
517 *ptr++ = (uuid16 & 0x00ff); 512 *ptr++ = (uuid16 & 0x00ff);
518 *ptr++ = (uuid16 & 0xff00) >> 8; 513 *ptr++ = (uuid16 & 0xff00) >> 8;
519 eir_len += sizeof(uuid16);
520 uuids_start[0] += sizeof(uuid16); 514 uuids_start[0] += sizeof(uuid16);
521 } 515 }
522} 516}