<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25097">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">coverity: quench null deref warning in gscon_change_primary_lchan()<br><br>The if conditions for logging an lchan change made it look like<br>new_lchan might actually be NULL, which it never is. So rather pin<br>new_lchan as non-NULL with an assert and simplify the logic.<br><br>Related: CID#237146<br>Related: b0d854556dafe885d740346b1b34ab247cb09d56<br>Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9<br>---<br>M src/osmo-bsc/bsc_subscr_conn_fsm.c<br>1 file changed, 4 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/97/25097/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>index 671f065..afb633d 100644</span><br><span>--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c</span><br><span>@@ -699,13 +699,15 @@</span><br><span>   /* On release, do not receive release events that look like the primary lchan is gone. */</span><br><span>    struct gsm_lchan *old_lchan = conn->lchan;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+     OSMO_ASSERT(new_lchan);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>    if (old_lchan == new_lchan)</span><br><span>          return;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     if (!old_lchan && new_lchan)</span><br><span style="color: hsl(120, 100%, 40%);">+  if (!old_lchan)</span><br><span>              LOGPFSML(conn->fi, LOGL_DEBUG, "setting primary lchan for this conn to %s\n",</span><br><span>                    new_lchan->fi? osmo_fsm_inst_name(new_lchan->fi) : gsm_lchan_name(new_lchan));</span><br><span style="color: hsl(0, 100%, 40%);">-   else if (old_lchan && new_lchan)</span><br><span style="color: hsl(120, 100%, 40%);">+      else</span><br><span>                 LOGPFSML(conn->fi, LOGL_DEBUG, "primary lchan for this conn changes from %s to %s\n",</span><br><span>                    old_lchan->fi? osmo_fsm_inst_name(old_lchan->fi) : gsm_lchan_name(old_lchan),</span><br><span>                          new_lchan->fi? osmo_fsm_inst_name(new_lchan->fi) : gsm_lchan_name(new_lchan));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25097">change 25097</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/25097"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9 </div>
<div style="display:none"> Gerrit-Change-Number: 25097 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>