Change in osmocom-bb[master]: mobile/gsm48_mm.h: mark some structures as 'packed'

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Nov 17 12:11:57 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/16088 )


Change subject: mobile/gsm48_mm.h: mark some structures as 'packed'
......................................................................

mobile/gsm48_mm.h: mark some structures as 'packed'

In several code paths we put / push structures from 'gsm48_mm.h' into
the message buffers, so then they're unpacked by the message receivers.

The AddressSanitizer complains about unaligned pointer access and
potentially unexpected behaviour. Let's fix this by explicitly
marking those structures as 'packed'.

Change-Id: I6af7475c609b3293af708540d569fe1616fab43f
---
M src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/88/16088/1

diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
index 93e7c4c..09d18ed 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h
@@ -61,7 +61,7 @@
 	uint8_t		sapi; /* sapi */
 	uint8_t		emergency; /* emergency type of call */
 	uint8_t		cause; /* cause used for release */
-};
+} __attribute__((packed));
 
 /* GSM 6.1.2 */
 #define	GSM48_MMR_REG_REQ		0x01
@@ -74,7 +74,7 @@
 	int		msg_type;
 
 	uint8_t		cause;
-};
+} __attribute__((packed));
 
 /* GSM 04.07 9.2.1 */
 #define GSM48_MMXX_ST_IDLE		0
@@ -140,7 +140,7 @@
 	uint32_t	msg_type;
 
 	uint8_t		sres[4];
-};
+} __attribute__((packed));
 
 /* GSM 04.08 MM timers */
 #define GSM_T3210_MS    20, 0

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/16088
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I6af7475c609b3293af708540d569fe1616fab43f
Gerrit-Change-Number: 16088
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191117/06a63d09/attachment.htm>


More information about the gerrit-log mailing list