All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/1] bap: Allocate memory for broadcast code
@ 2024-06-18  8:58 Vlad Pruteanu
  2024-06-18  8:58 ` [PATCH BlueZ 1/1] " Vlad Pruteanu
  0 siblings, 1 reply; 5+ messages in thread
From: Vlad Pruteanu @ 2024-06-18  8:58 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, silviu.barbulescu, iulia.tanasescu,
	andrei.istodorescu, luiz.dentz, Vlad Pruteanu

This fixes segmentation fault caused by trying to write to
unallocated memory.

Vlad Pruteanu (1):
  bap: Allocate memory for broadcast code

 profiles/audio/bap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH BlueZ v2 1/2] shared/util: Add util_iov_new function
@ 2024-06-19  9:51 Vlad Pruteanu
  2024-06-19 12:07 ` bap: Allocate memory for broadcast code bluez.test.bot
  0 siblings, 1 reply; 5+ messages in thread
From: Vlad Pruteanu @ 2024-06-19  9:51 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: mihai-octavian.urzica, iulia.tanasescu, andrei.istodorescu,
	luiz.dentz, Vlad Pruteanu

This adds the util_iov_new function that allows the user both allocated
and set an iovec to the desired value, using only one function call.
---
 src/shared/util.c | 10 ++++++++++
 src/shared/util.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/src/shared/util.c b/src/shared/util.c
index 6a29b5068..30f054a5e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -542,6 +542,16 @@ void *util_iov_append(struct iovec *iov, const void *data, size_t len)
 	return util_iov_push_mem(iov, len, data);
 }
 
+struct iovec *util_iov_new(void *data, size_t len)
+{
+	struct iovec *iov;
+
+	iov = new0(struct iovec, 1);
+	util_iov_append(iov, data, len);
+
+	return iov;
+}
+
 void *util_iov_pull(struct iovec *iov, size_t len)
 {
 	if (!iov)
diff --git a/src/shared/util.h b/src/shared/util.h
index bd71577d6..f2ca4f29f 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -176,6 +176,7 @@ void *util_iov_push_le16(struct iovec *iov, uint16_t val);
 void *util_iov_push_be16(struct iovec *iov, uint16_t val);
 void *util_iov_push_u8(struct iovec *iov, uint8_t val);
 void *util_iov_append(struct iovec *iov, const void *data, size_t len);
+struct iovec *util_iov_new(void *data, size_t len);
 void *util_iov_pull(struct iovec *iov, size_t len);
 void *util_iov_pull_mem(struct iovec *iov, size_t len);
 void *util_iov_pull_le64(struct iovec *iov, uint64_t *val);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-19 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18  8:58 [PATCH BlueZ 0/1] bap: Allocate memory for broadcast code Vlad Pruteanu
2024-06-18  8:58 ` [PATCH BlueZ 1/1] " Vlad Pruteanu
2024-06-18 10:44   ` bluez.test.bot
2024-06-18 15:23   ` [PATCH BlueZ 1/1] " Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2024-06-19  9:51 [PATCH BlueZ v2 1/2] shared/util: Add util_iov_new function Vlad Pruteanu
2024-06-19 12:07 ` bap: Allocate memory for broadcast code bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.