From 8146d8f7dd675d7b0f8e997f39add23b1cc4e578 Mon Sep 17 00:00:00 2001 From: Iulia Tanasescu Date: Wed, 2 Oct 2024 16:35:06 +0300 Subject: [PATCH] shared/bap: Fix load of misaligned address error This fixes the "load of misaligned address" error that appears when parsing PAC caps: src/shared/bap.c:6497:7: runtime error: load of misaligned address 0x502000063639 for type 'uint16_t', which requires 2 byte alignment 0x502000063639: note: pointer points here 02 03 05 04 1a 00 f0 00 02 03 01 02 11 00 00 08 00 00 00 a3 00 00 ^ 00 00 00 00 00 01 00 00 00 01 src/shared/bap.c:6498:7: runtime error: load of misaligned address 0x502000063639 for type 'uint16_t', which requires 2 byte alignment 0x502000063639: note: pointer points here 02 03 05 04 1a 00 f0 00 02 03 01 02 11 00 00 08 00 00 00 a3 00 00 ^ 00 00 00 00 00 01 00 00 00 01 --- src/shared/bap.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 72f0f8a03..00c3b9ff6 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6484,8 +6484,8 @@ static void check_pac_caps_ltv(size_t i, uint8_t l, uint8_t t, uint8_t *v, switch (t) { case BAP_FREQ_LTV_TYPE: - mask = *((uint16_t *)v); - mask = le16_to_cpu(mask); + mask = get_le16(v); + if (mask & (1 << (bis_v[0] - 1))) compare_data->data32 |= 1<data32 |= 1<= min) && (frame_len <= max)) compare_data->data32 |= 1<