Change in osmo-bsc[master]: coverity: quench null deref warning in gscon_change_primary_lchan()

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

neels gerrit-no-reply at
Thu Jul 29 12:43:49 UTC 2021

neels has uploaded this change for review. ( )

Change subject: coverity: quench null deref warning in gscon_change_primary_lchan()

coverity: quench null deref warning in gscon_change_primary_lchan()

The if conditions for logging an lchan change made it look like
new_lchan might actually be NULL, which it never is. So rather pin
new_lchan as non-NULL with an assert and simplify the logic.

Related: CID#237146
Related: b0d854556dafe885d740346b1b34ab247cb09d56
Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9
M src/osmo-bsc/bsc_subscr_conn_fsm.c
1 file changed, 4 insertions(+), 2 deletions(-)

  git pull ssh:// refs/changes/97/25097/1

diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 671f065..afb633d 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -699,13 +699,15 @@
 	/* On release, do not receive release events that look like the primary lchan is gone. */
 	struct gsm_lchan *old_lchan = conn->lchan;
+	OSMO_ASSERT(new_lchan);
 	if (old_lchan == new_lchan)
-	if (!old_lchan && new_lchan)
+	if (!old_lchan)
 		LOGPFSML(conn->fi, LOGL_DEBUG, "setting primary lchan for this conn to %s\n",
 			 new_lchan->fi? osmo_fsm_inst_name(new_lchan->fi) : gsm_lchan_name(new_lchan));
-	else if (old_lchan && new_lchan)
+	else
 		LOGPFSML(conn->fi, LOGL_DEBUG, "primary lchan for this conn changes from %s to %s\n",
 			 old_lchan->fi? osmo_fsm_inst_name(old_lchan->fi) : gsm_lchan_name(old_lchan),
 			 new_lchan->fi? osmo_fsm_inst_name(new_lchan->fi) : gsm_lchan_name(new_lchan));

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9
Gerrit-Change-Number: 25097
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list