Change in osmo-bsc[master]: coverity: gscon_forget_lchan: squelch forward-null

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Nov 12 15:40:05 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/11742


Change subject: coverity: gscon_forget_lchan: squelch forward-null
......................................................................

coverity: gscon_forget_lchan: squelch forward-null

conn->fi should actually never be NULL, they are allocated and discarded
simultaneously. So check its null from the start and remove some conditions
below, to remove the coverity warning.

The warning was introduced in recent 946d1fb5c7f4a593567b407222c9235f8fac7a59

Related: CID 189671
Change-Id: I62354aa998832131c86535f39a29294000114adc
---
M src/osmo-bsc/bsc_subscr_conn_fsm.c
1 file changed, 4 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/42/11742/1

diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 4d6521f..3a4ae7e 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -652,7 +652,7 @@
 void gscon_forget_lchan(struct gsm_subscriber_connection *conn, struct gsm_lchan *lchan)
 {
 	const char *detach_label = NULL;
-	if (!conn)
+	if (!conn || !conn->fi)
 		return;
 	if (!lchan)
 		return;
@@ -672,13 +672,12 @@
 
 	/* Log for both lchan FSM and conn FSM to ease reading the log in case of problems */
 	if (detach_label) {
-		if (conn->fi)
-			LOGPFSML(conn->fi, LOGL_DEBUG, "conn detaches lchan %s\n",
-				 lchan->fi? osmo_fsm_inst_name(lchan->fi) : gsm_lchan_name(lchan));
+		LOGPFSML(conn->fi, LOGL_DEBUG, "conn detaches lchan %s\n",
+			 lchan->fi? osmo_fsm_inst_name(lchan->fi) : gsm_lchan_name(lchan));
 
 		if (lchan->fi)
 			LOGPFSML(lchan->fi, LOGL_DEBUG, "conn %s detaches lchan (%s)\n",
-				 conn->fi? osmo_fsm_inst_name(conn->fi) : "(conn without FSM)",
+				 osmo_fsm_inst_name(conn->fi) : "(conn without FSM)",
 				 detach_label);
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/11742
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62354aa998832131c86535f39a29294000114adc
Gerrit-Change-Number: 11742
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181112/6bc4a05b/attachment.htm>


More information about the gerrit-log mailing list