[PATCH] 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/.

Max gerrit-no-reply at lists.osmocom.org
Mon May 29 14:38:24 UTC 2017


Review at  https://gerrit.osmocom.org/2785

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/85/2785/1

diff --git a/src/common/oml.c b/src/common/oml.c
index 3f0f238..4e199e2 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: newchange
Gerrit-Change-Id: Ib3f91be97c8bf81a87681814bf81d3a5a9950e54
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list