summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-08-11 12:55:43 +0200
committerHarald Welte <laforge@gnumonks.org>2018-08-11 12:59:30 +0000
commit82d8370f623c7b5054afff729db35880d01fd45c (patch)
tree4871e872e46c8803aee4519e3360f2d9ca58383f /src/host/layer23/src
parent4d07f40b9427743902df86a128453572ba1734bb (diff)
layer23: fix unaligned store in osmo_send_l1()
This fixes the following alignment issue uncovered by asan: l1l2_interface.c:169:7: runtime error: store to misaligned address 0x61600001ab99 for type 'uint16_t', which requires 2 byte alignment 0x61600001ab99: note: pointer points here 00 00 00 00 00 00 06 0a 01 19 19 40 18 00 07 00 01 03 49 06 15 00 40 01 c0 00 00 00 00 00 00 00 ^ Change-Id: Ie65b428107d35bac99bc870fdbc4dc509ca2f33c
Diffstat (limited to 'src/host/layer23/src')
-rw-r--r--src/host/layer23/src/common/l1l2_interface.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/host/layer23/src/common/l1l2_interface.c b/src/host/layer23/src/common/l1l2_interface.c
index d89995d9..956279d3 100644
--- a/src/host/layer23/src/common/l1l2_interface.c
+++ b/src/host/layer23/src/common/l1l2_interface.c
@@ -157,16 +157,13 @@ int layer2_close(struct osmocom_ms *ms)
int osmo_send_l1(struct osmocom_ms *ms, struct msgb *msg)
{
- uint16_t *len;
-
DEBUGP(DL1C, "Sending: '%s'\n", osmo_hexdump(msg->data, msg->len));
if (msg->l1h != msg->data)
LOGP(DL1C, LOGL_ERROR, "Message L1 header != Message Data\n");
-
+
/* prepend 16bit length before sending */
- len = (uint16_t *) msgb_push(msg, sizeof(*len));
- *len = htons(msg->len - sizeof(*len));
+ msgb_push_u16(msg, msg->len);
if (osmo_wqueue_enqueue(&ms->l2_wq, msg) != 0) {
LOGP(DL1C, LOGL_ERROR, "Failed to enqueue msg.\n");