Change in osmo-bsc[master]: bts_ipaccess_nanobts: check if msgb_alloc fails

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/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Nov 28 11:24:35 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/21394 )

Change subject: bts_ipaccess_nanobts: check if msgb_alloc fails
......................................................................

bts_ipaccess_nanobts: check if msgb_alloc fails

Change-Id: Ib7867fa29d62eeea2cbc5603b28e5b00d0f62222
---
M src/osmo-bsc/bts_ipaccess_nanobts.c
M src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
2 files changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 577be13..f9dc8b3 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -179,6 +179,8 @@
 			break;
 		if (new_state->availability == NM_AVSTATE_DEPENDENCY) {
 			msgb = nanobts_attr_nse_get(bts);
+			if (!msgb)
+				break;
 			abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
 						  0xff, 0xff, msgb->data,
 						  msgb->len);
@@ -193,6 +195,8 @@
 			break;
 		if (new_state->availability == NM_AVSTATE_DEPENDENCY) {
 			msgb = nanobts_attr_cell_get(bts);
+			if (!msgb)
+				break;
 			abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
 						  0, 0xff, msgb->data,
 						  msgb->len);
@@ -222,6 +226,8 @@
 		if ((new_state->availability == NM_AVSTATE_OFF_LINE) ||
 		    (new_state->availability == NM_AVSTATE_DEPENDENCY)) {
 			msgb = nanobts_attr_nscv_get(bts);
+			if (!msgb)
+				break;
 			abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
 						  nsvc->id, 0xff,
 						  msgb->data, msgb->len);
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
index b723932..6d64a4b 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -32,6 +32,8 @@
 	uint8_t buf[256];
 	int rlt;
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
+	if (!msgb)
+		return NULL;
 
 	memcpy(buf, "\x55\x5b\x61\x67\x6d\x73", 6);
 	msgb_tv_fixed_put(msgb, NM_ATT_INTERF_BOUND, 6, buf);
@@ -104,6 +106,8 @@
 	struct msgb *msgb;
 	uint8_t buf[256];
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
+	if (!msgb)
+		return NULL;
 
 	/* NSEI 925 */
 	buf[0] = bts->gprs.nse.nsei >> 8;
@@ -140,6 +144,8 @@
 	struct msgb *msgb;
 	uint8_t buf[256];
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
+	if (!msgb)
+		return NULL;
 
 	/* routing area code */
 	buf[0] = bts->gprs.rac;
@@ -197,6 +203,8 @@
 	struct msgb *msgb;
 	uint8_t buf[256];
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
+	if (!msgb)
+		return NULL;
 
 	/* 925 */
 	buf[0] = bts->gprs.nsvc[0].nsvci >> 8;
@@ -240,6 +248,8 @@
 	struct msgb *msgb;
 	uint8_t buf[256];
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
+	if (!msgb)
+		return NULL;
 
 	/* number of -2dB reduction steps / Pn */
 	msgb_tv_put(msgb, NM_ATT_RF_MAXPOWR_R, trx->max_power_red / 2);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib7867fa29d62eeea2cbc5603b28e5b00d0f62222
Gerrit-Change-Number: 21394
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201128/e7a33403/attachment.htm>


More information about the gerrit-log mailing list