Re: [PATCH 4/6] Bluetooth: Refactor UUID-16 list generation into its own function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johan,

On Thu, Jan 24, 2013 at 3:03 PM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
> +static u8 *create_uuid16_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len)
> +{
> +       u8 *ptr = data, *uuids_start = NULL;
> +       struct bt_uuid *uuid;

Maybe you should check for "len < 2" here?

> +
> +       list_for_each_entry(uuid, &hdev->uuid16, list) {
> +               u16 uuid16;
> +
> +               uuid16 = get_unaligned_le16(&uuid->uuid[12]);
> +               if (uuid16 < 0x1100)
> +                       continue;
> +
> +               if (uuid16 == PNP_INFO_SVCLASS_ID)
> +                       continue;
> +
> +               if (!uuids_start) {
> +                       uuids_start = ptr;
> +                       uuids_start[0] = 1;
> +                       uuids_start[1] = EIR_UUID16_ALL;
> +                       ptr += 2;
> +               }
> +
> +               /* Stop if not enough space to put next UUID */
> +               if ((ptr - data) + sizeof(u16) > len) {
> +                       uuids_start[1] = EIR_UUID16_SOME;
> +                       break;
> +               }
> +
> +               *ptr++ = (uuid16 & 0x00ff);
> +               *ptr++ = (uuid16 & 0xff00) >> 8;
> +               uuids_start[0] += sizeof(uuid16);
> +       }
> +
> +       return ptr;
> +}

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux