[MERGED] osmo-bts[master]: OML: fix Coverity-reported 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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon May 29 21:13:45 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: OML: fix Coverity-reported issues
......................................................................


OML: fix Coverity-reported issues

* CID 169803:  Null pointer dereferences
* CID 169802:  Incorrect expression

Change-Id: Ib3f91be97c8bf81a87681814bf81d3a5a9950e54
Related: OS#1614
---
M src/common/oml.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/oml.c b/src/common/oml.c
index 290c345..9dddf57 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -163,7 +163,7 @@
 	abis_nm_put_sw_file(a, btstype2str(GSM_BTS_TYPE_OSMOBTS), PACKAGE_VERSION, true);
 	abis_nm_put_sw_file(a, btsatttr2str(BTS_TYPE_VARIANT), btsvariant2str(bts->variant), true);
 
-	if (bts->sub_model)
+	if (strlen(bts->sub_model))
 		abis_nm_put_sw_file(a, btsatttr2str(BTS_SUB_MODEL), bts->sub_model, true);
 
 	return a;
@@ -467,9 +467,13 @@
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(msg);
 	struct tlv_parsed tp;
-	struct gsm_abis_mo *mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
+	struct gsm_abis_mo *mo;
 	int rc;
 
+	if (!foh)
+		return -EINVAL;
+
+	mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
 	abis_nm_debugp_foh(DOML, foh);
 	DEBUGPC(DOML, "Rx GET ATTR\n");
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3f91be97c8bf81a87681814bf81d3a5a9950e54
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list