Harald Welte has submitted this change and it was merged.

Change subject: use tlvp_val16be() rather than manual pointer-cast + ntohs()
......................................................................


use tlvp_val16be() rather than manual pointer-cast + ntohs()

Change-Id: Ib77cb703bb1710da396db3a939700515b5c20235
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 2 insertions(+), 4 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index aeb0942..d3c8491 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -155,9 +155,8 @@
        if (TLVP_PRESENT(tp, BSSGP_IE_PDU_LIFETIME))
        {
                uint8_t lt_len = TLVP_LEN(tp, BSSGP_IE_PDU_LIFETIME);
-               uint16_t *lt = (uint16_t *) TLVP_VAL(tp, BSSGP_IE_PDU_LIFETIME);
                if (lt_len == 2)
-                       delay_csec = ntohs(*lt);
+                       delay_csec = tlvp_val16be(tp, BSSGP_IE_PDU_LIFETIME);
                else
                        LOGP(DBSSGP, LOGL_NOTICE, "BSSGP invalid length of "
                                "PDU_LIFETIME IE\n");
@@ -169,9 +168,8 @@
        if (TLVP_PRESENT(tp, BSSGP_IE_TLLI))
        {
                uint8_t tlli_len = TLVP_LEN(tp, BSSGP_IE_PDU_LIFETIME);
-               uint16_t *e_tlli_old = (uint16_t *) TLVP_VAL(tp, BSSGP_IE_TLLI);
                if (tlli_len == 2)
-                       tlli_old = ntohs(*e_tlli_old);
+                       tlli_old = tlvp_val16be(tp, BSSGP_IE_TLLI);
                else
                        LOGP(DBSSGP, LOGL_NOTICE, "BSSGP invalid length of "
                                "TLLI (old) IE\n");

-- 
To view, visit https://gerrit.osmocom.org/2875
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib77cb703bb1710da396db3a939700515b5c20235
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msur...@sysmocom.de>

Reply via email to