fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/29281 ) Change subject: llc: gprs_llc_hdr_rx(): avoid using 'struct gprs_llc_hdr' ...................................................................... llc: gprs_llc_hdr_rx(): avoid using 'struct gprs_llc_hdr' Neither this structure is defined in osmo-sgsn.git, nor in any of its dependencies. GCC does not complain because it's not really used: the only two "users" convert it to 'uint8_t *'. Change-Id: Idc6262f61971e13545fab884ce401e2b78505f01 --- M src/sgsn/gprs_llc.c 1 file changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/81/29281/1 diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c index f16f200..ba6f323 100644 --- a/src/sgsn/gprs_llc.c +++ b/src/sgsn/gprs_llc.c @@ -911,7 +911,8 @@ /* receive an incoming LLC PDU (BSSGP-UL-UNITDATA-IND, 7.2.4.2) */ int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv) { - struct gprs_llc_hdr *lh = (struct gprs_llc_hdr *) msgb_llch(msg); + const uint8_t *llc_pdu = TLVP_VAL(tv, BSSGP_IE_LLC_PDU); + size_t llc_pdu_len = TLVP_LEN(tv, BSSGP_IE_LLC_PDU); struct gprs_llc_hdr_parsed llhp; struct gprs_llc_lle *lle = NULL; bool drop_cipherable = false; @@ -920,7 +921,7 @@ /* Identifiers from DOWN: NSEI, BVCI, TLLI */ memset(&llhp, 0, sizeof(llhp)); - rc = gprs_llc_hdr_parse(&llhp, (uint8_t *) lh, TLVP_LEN(tv, BSSGP_IE_LLC_PDU)); + rc = gprs_llc_hdr_parse(&llhp, llc_pdu, llc_pdu_len); if (rc < 0) { LOGP(DLLC, LOGL_NOTICE, "Error during LLC header parsing\n"); return rc; @@ -980,7 +981,7 @@ } /* We have to do the FCS check _after_ decryption */ - llhp.fcs_calc = gprs_llc_fcs((uint8_t *)lh, llhp.crc_length); + llhp.fcs_calc = gprs_llc_fcs(llc_pdu, llhp.crc_length); if (llhp.fcs != llhp.fcs_calc) { LOGP(DLLC, LOGL_INFO, "Dropping frame with invalid FCS\n"); return -EIO; -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/29281 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Idc6262f61971e13545fab884ce401e2b78505f01 Gerrit-Change-Number: 29281 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-MessageType: newchange