Re: [PATCH BlueZ 1/1] bap: Allocate memory for broadcast code

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

 



Hi Vlad,

On Tue, Jun 18, 2024 at 4:58 AM Vlad Pruteanu <vlad.pruteanu@xxxxxxx> wrote:
>
> This fixes segmentation fault caused by trying to write to
> unallocated memory.
> ---
>  profiles/audio/bap.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> index 53e7b3e34..3d249a4e4 100644
> --- a/profiles/audio/bap.c
> +++ b/profiles/audio/bap.c
> @@ -1041,10 +1041,12 @@ static void create_stream_for_bis(struct bap_data *bap_data,
>         setup->qos.bcast.packing = qos->bcast.packing;
>         setup->qos.bcast.framing = qos->bcast.framing;
>         setup->qos.bcast.encryption = qos->bcast.encryption;
> -       if (setup->qos.bcast.encryption)
> +       if (setup->qos.bcast.encryption) {
> +               setup->qos.bcast.bcode = new0(struct iovec, 1);

I wonder if it wouldn't be better to add something like struct iovec
*util_iov_new(void *data, size_t len) so we don't have to do this in 2
steps?

>                 util_iov_append(setup->qos.bcast.bcode,
>                                 qos->bcast.bcode,
>                                 sizeof(qos->bcast.bcode));
> +       }
>         setup->qos.bcast.options = qos->bcast.options;
>         setup->qos.bcast.skip = qos->bcast.skip;
>         setup->qos.bcast.sync_timeout = qos->bcast.sync_timeout;
> --
> 2.40.1
>


-- 
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