From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] monitor: Fix misaligment errors
Date: Fri, 5 May 2023 13:31:56 -0700 [thread overview]
Message-ID: <20230505203156.2561265-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20230505203156.2561265-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes the following errors:
monitor/packet.c:11968:27: runtime error: member access within
misaligned address 0x565448026d55 for type
'const struct monitor_l2cap_hdr', which requires 2 byte alignment
monitor/packet.c:11968:4: runtime error: member access within
misaligned address 0x565448026d55 for type
'const struct monitor_l2cap_hdr', which requires 2 byte alignment
---
monitor/packet.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/monitor/packet.c b/monitor/packet.c
index 645e3f97ef40..94561b65ea75 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -11945,7 +11945,7 @@ void packet_system_note(struct timeval *tv, struct ucred *cred,
struct monitor_l2cap_hdr {
uint16_t cid;
uint16_t psm;
-};
+} __attribute__((packed));
static void packet_decode(struct timeval *tv, struct ucred *cred, char dir,
uint16_t index, const char *color,
@@ -11964,7 +11964,8 @@ static void packet_decode(struct timeval *tv, struct ucred *cred, char dir,
NULL);
/* Discard last byte since it just a filler */
- l2cap_frame(index, dir == '>', 0, hdr->cid, hdr->psm,
+ l2cap_frame(index, dir == '>', 0,
+ le16_to_cpu(hdr->cid), le16_to_cpu(hdr->psm),
data + sizeof(*hdr), size - (sizeof(*hdr) + 1));
}
--
2.40.0
next prev parent reply other threads:[~2023-05-05 20:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 20:31 [PATCH BlueZ 1/2] monitor/att: Attempt to insert discovered attributes Luiz Augusto von Dentz
2023-05-05 20:31 ` Luiz Augusto von Dentz [this message]
2023-05-05 22:00 ` [BlueZ,1/2] " bluez.test.bot
2023-05-09 0:20 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230505203156.2561265-2-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox