From ecc76ef69a90d1e12f3a9f327b6a90058a2d4518 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 16 Dec 2021 12:58:49 +0100 Subject: [PATCH] Fix several Coverity found issues Closes: CID#242770 Closes: CID#242769 Closes: CID#242767 Change-Id: I6d73a970919889953539fbacc601d679d7ec4113 --- src/osmo-hnodeb/gtp.c | 18 ++++++++++-------- src/osmo-hnodeb/rua.c | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/osmo-hnodeb/gtp.c b/src/osmo-hnodeb/gtp.c index 4695ea9..b8bfebc 100644 --- a/src/osmo-hnodeb/gtp.c +++ b/src/osmo-hnodeb/gtp.c @@ -45,14 +45,15 @@ static int hnb_gtp_cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len { struct hnb_gtp_prim *gtp_prim; struct hnb_ue *ue = lib->priv; - struct hnb *hnb = ue->hnb; + struct hnb *hnb; int rc; if (!ue || !ue->conn_ps.active) { - LOGUE(ue, DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u but UE conn_ps is not active!\n", + LOGP(DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u but UE conn_ps is not active!\n", packet, len); return -EINVAL; } + hnb = ue->hnb; LOGUE(ue, DGTP, LOGL_DEBUG, "Tx GTP-CONN_DATA.ind data=%p len=%u\n", packet, len); gtp_prim = hnb_gtp_makeprim_conn_data_ind(ue->conn_id, ue->conn_ps.local_tei, packet, len); @@ -180,18 +181,19 @@ int hnb_ue_gtp_bind(struct hnb_ue *ue, const struct osmo_sockaddr *rem_addr, uin int hnb_ue_gtp_tx(struct hnb_ue *ue, void *gtpu_payload, unsigned gtpu_payload_len) { int rc; - struct hnb *hnb = ue->hnb; - - if (!hnb->gtp.gsn) { - LOGUE(ue, DGTP, LOGL_ERROR, "Tx: GTP socket not bound\n"); - return -EINVAL; - } + struct hnb *hnb; if (!ue || !ue->conn_ps.pdp_lib) { LOGUE(ue, DGTP, LOGL_ERROR, "Tx: UE PDP Ctx not available\n"); return -EINVAL; } + hnb = ue->hnb; + if (!hnb->gtp.gsn) { + LOGUE(ue, DGTP, LOGL_ERROR, "Tx: GTP socket not bound\n"); + return -EINVAL; + } + rc = gtp_data_req(hnb->gtp.gsn, ue->conn_ps.pdp_lib, gtpu_payload, gtpu_payload_len); return rc; } diff --git a/src/osmo-hnodeb/rua.c b/src/osmo-hnodeb/rua.c index 3a73f0c..5b225de 100644 --- a/src/osmo-hnodeb/rua.c +++ b/src/osmo-hnodeb/rua.c @@ -140,6 +140,7 @@ static int hnb_rua_rx_initiating(struct hnb *hnb, RUA_InitiatingMessage_t *init) case RUA_ProcedureCode_id_DirectTransfer: LOGP(DRUA, LOGL_INFO, "RUA rx Initiating DirectTransfer\n"); hnb_rua_dt_handle(hnb, &init->value); + break; default: LOGP(DRUA, LOGL_INFO, "RUA rx unknown Initiating message\n"); break;