diff mbox series

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

Message ID 20240618085823.30798-2-vlad.pruteanu@nxp.com (mailing list archive)
State Superseded
Headers show
Series bap: Allocate memory for broadcast code | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Vlad Pruteanu June 18, 2024, 8:58 a.m. UTC
This fixes segmentation fault caused by trying to write to
unallocated memory.
---
 profiles/audio/bap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com June 18, 2024, 10:44 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=862936

---Test result---

Test Summary:
CheckPatch                    PASS      0.40 seconds
GitLint                       PASS      0.29 seconds
BuildEll                      PASS      25.46 seconds
BluezMake                     PASS      1731.99 seconds
MakeCheck                     PASS      13.66 seconds
MakeDistcheck                 PASS      183.45 seconds
CheckValgrind                 PASS      259.49 seconds
CheckSmatch                   PASS      364.19 seconds
bluezmakeextell               PASS      125.23 seconds
IncrementalBuild              PASS      1506.81 seconds
ScanBuild                     PASS      1052.66 seconds



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz June 18, 2024, 3:23 p.m. UTC | #2
Hi Vlad,

On Tue, Jun 18, 2024 at 4:58 AM Vlad Pruteanu <vlad.pruteanu@nxp.com> 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
>
diff mbox series

Patch

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