Change in osmo-hnodeb[master]: Fix several Coverity found issues

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Dec 16 15:32:51 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26595 )

Change subject: Fix several Coverity found issues
......................................................................

Fix several Coverity found issues

Closes: CID#242770
Closes: CID#242769
Closes: CID#242767
Change-Id: I6d73a970919889953539fbacc601d679d7ec4113
---
M src/osmo-hnodeb/gtp.c
M src/osmo-hnodeb/rua.c
2 files changed, 11 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



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 @@
 {
 	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_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 @@
 	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;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26595
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I6d73a970919889953539fbacc601d679d7ec4113
Gerrit-Change-Number: 26595
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211216/143da3d0/attachment.htm>


More information about the gerrit-log mailing list