diff options
author | Max <msuraev@sysmocom.de> | 2016-04-23 19:37:58 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-04-24 11:12:41 +0200 |
commit | 27e8036d418181e390809c8668d15a9ab425be59 (patch) | |
tree | ee124296ceb52052433a2a68856fe5d1f3108f6a | |
parent | 8a5346ba2f7ed7b4e69d32397b99d11c14694a2a (diff) |
Fix unaligned access found by addr. sanitizer
gprs_bssgp.c:461:9: runtime error: load of misaligned address
0x62100001a66b for type 'uint32_t', which requires 4 byte alignment
gprs_ns.c:937:16: runtime error: load of misaligned address
0x61d00002a97f for type 'uint16_t', which requires 2 byte alignment
-rw-r--r-- | src/gb/gprs_bssgp.c | 4 | ||||
-rw-r--r-- | src/gb/gprs_ns.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index d9d8ccd8..3ad2f297 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -416,7 +416,7 @@ static int bssgp_rx_suspend(struct msgb *msg, struct tlv_parsed *tp) return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); } - tlli = ntohl(*(uint32_t *)TLVP_VAL(tp, BSSGP_IE_TLLI)); + tlli = ntohl(tlvp_val32_unal(tp, BSSGP_IE_TLLI)); DEBUGP(DBSSGP, "BSSGP BVCI=%u TLLI=0x%08x Rx SUSPEND\n", ns_bvci, tlli); @@ -458,7 +458,7 @@ static int bssgp_rx_resume(struct msgb *msg, struct tlv_parsed *tp) return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg); } - tlli = ntohl(*(uint32_t *)TLVP_VAL(tp, BSSGP_IE_TLLI)); + tlli = ntohl(tlvp_val32_unal(tp, BSSGP_IE_TLLI)); suspend_ref = *TLVP_VAL(tp, BSSGP_IE_SUSPEND_REF_NR); DEBUGP(DBSSGP, "BSSGP BVCI=%u TLLI=0x%08x Rx RESUME\n", ns_bvci, tlli); diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index a29c9464..6879c708 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -934,8 +934,8 @@ static int gprs_ns_rx_reset_ack(struct gprs_nsvc **nsvc, struct msgb *msg) return -EINVAL; } - nsvci = ntohs(*(uint16_t *) TLVP_VAL(&tp, NS_IE_VCI)); - nsei = ntohs(*(uint16_t *) TLVP_VAL(&tp, NS_IE_NSEI)); + nsvci = ntohs(tlvp_val16_unal(&tp, NS_IE_VCI)); + nsei = ntohs(tlvp_val16_unal(&tp, NS_IE_NSEI)); LOGP(DNS, LOGL_INFO, "NSVCI=%u%s Rx NS RESET ACK (NSEI=%u, NSVCI=%u)\n", (*nsvc)->nsvci, (*nsvc)->nsvci_is_valid ? "" : "(invalid)", |