diff mbox series

[BlueZ,2/2] monitor: Fix misaligment errors

Message ID 20230505203156.2561265-2-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit acfa41dedb47f1bff9399e2273e4623aac4decc5
Headers show
Series [BlueZ,1/2] monitor/att: Attempt to insert discovered attributes | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #106: FILE: monitor/packet.c:11948: +} __attribute__((packed)); /github/workspace/src/src/13233010.patch total: 0 errors, 1 warnings, 17 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13233010.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz May 5, 2023, 8:31 p.m. UTC
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 mbox series

Patch

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