Re: [PATCH v4 1/4] Bluetooth: net: add hci_iso_hdr function for iso data

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

 



Hi Chris,

On Thu, Jun 6, 2024 at 7:43 AM Chris Lu <chris.lu@xxxxxxxxxxxx> wrote:
>
> Add function hci_iso_hdr to get skb->data when packet type is ISO.
>
> Signed-off-by: Chris Lu <chris.lu@xxxxxxxxxxxx>
> Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx>
> ---
>  include/net/bluetooth/hci.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index e372a88e8c3f..b9f8f91f6c7f 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -2898,6 +2898,11 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
>         return (struct hci_sco_hdr *) skb->data;
>  }
>
> +static inline struct hci_iso_hdr *hci_iso_hdr(const struct sk_buff *skb)
> +{
> +       return (struct hci_iso_hdr *) skb->data;
> +}

We might as well check the skb->len before attempting to cast
skb->data or better yet use skb_pull_data but I guess that is not
possible since you don't want to consume the skb?

>  /* Command opcode pack/unpack */
>  #define hci_opcode_pack(ogf, ocf)      ((__u16) ((ocf & 0x03ff)|(ogf << 10)))
>  #define hci_opcode_ogf(op)             (op >> 10)
> --
> 2.18.0
>


-- 
Luiz Augusto von Dentz





[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