linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/1] shared/bap: Fix load of misaligned address error
@ 2024-10-02 13:35 Iulia Tanasescu
  2024-10-02 13:35 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
  2024-10-03 16:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 4+ messages in thread
From: Iulia Tanasescu @ 2024-10-02 13:35 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, Iulia Tanasescu

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

Iulia Tanasescu (1):
  shared/bap: fix load of misaligned address error

 src/shared/bap.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)


base-commit: 38734e02051364b4b6db6e684beda8c47a1ba452
-- 
2.43.0


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

* [PATCH BlueZ 1/1] shared/bap: Fix load of misaligned address error
  2024-10-02 13:35 [PATCH BlueZ 0/1] shared/bap: Fix load of misaligned address error Iulia Tanasescu
@ 2024-10-02 13:35 ` Iulia Tanasescu
  2024-10-02 15:02   ` bluez.test.bot
  2024-10-03 16:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
  1 sibling, 1 reply; 4+ messages in thread
From: Iulia Tanasescu @ 2024-10-02 13:35 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, vlad.pruteanu,
	andrei.istodorescu, luiz.dentz, Iulia Tanasescu

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<<t;
 		break;
@@ -6494,12 +6494,10 @@ static void check_pac_caps_ltv(size_t i, uint8_t l, uint8_t t, uint8_t *v,
 			compare_data->data32 |= 1<<t;
 		break;
 	case BAP_FRAME_LEN_LTV_TYPE:
-		min = *((uint16_t *)v);
-		max = *((uint16_t *)(&v[2]));
-		frame_len = *((uint16_t *)bis_v);
-		min = le16_to_cpu(min);
-		max = le16_to_cpu(max);
-		frame_len = le16_to_cpu(frame_len);
+		min = get_le16(v);
+		max = get_le16(v + 2);
+		frame_len = get_le16(bis_v);
+
 		if ((frame_len >= min) &&
 				(frame_len <= max))
 			compare_data->data32 |= 1<<t;
-- 
2.43.0


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

* RE: shared/bap: Fix load of misaligned address error
  2024-10-02 13:35 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2024-10-02 15:02   ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-10-02 15:02 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.27 seconds
GitLint                       PASS      0.19 seconds
BuildEll                      PASS      24.11 seconds
BluezMake                     PASS      1505.09 seconds
MakeCheck                     PASS      13.40 seconds
MakeDistcheck                 PASS      175.26 seconds
CheckValgrind                 PASS      248.09 seconds
CheckSmatch                   WARNING   348.90 seconds
bluezmakeextell               PASS      117.56 seconds
IncrementalBuild              PASS      1393.01 seconds
ScanBuild                     PASS      1012.78 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:288:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures


---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ 0/1] shared/bap: Fix load of misaligned address error
  2024-10-02 13:35 [PATCH BlueZ 0/1] shared/bap: Fix load of misaligned address error Iulia Tanasescu
  2024-10-02 13:35 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2024-10-03 16:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-10-03 16:50 UTC (permalink / raw)
  To: Iulia Tanasescu
  Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
	vlad.pruteanu, andrei.istodorescu, luiz.dentz

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed,  2 Oct 2024 16:35:05 +0300 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/1] shared/bap: Fix load of misaligned address error
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8146d8f7dd67

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-10-03 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 13:35 [PATCH BlueZ 0/1] shared/bap: Fix load of misaligned address error Iulia Tanasescu
2024-10-02 13:35 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
2024-10-02 15:02   ` bluez.test.bot
2024-10-03 16:50 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).