<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13979">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libmsc/ran_msg_a.c: avoid ternary operator in struct initialization<br><br>For some reason, having ternary operator there makes Coverity think<br>that 'n->geran.chosen_encryption' is dereferenced before checking<br>against NULL. Let's make it happy, and move the assignment.<br><br>Change-Id: I95051d0f02e2fdd3ec8da3a506109e7b23e99b4b<br>Fixes: CID#198454 Dereference before null check<br>---<br>M src/libmsc/ran_msg_a.c<br>1 file changed, 1 insertion(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/79/13979/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c</span><br><span>index ba0990d..da32a84 100644</span><br><span>--- a/src/libmsc/ran_msg_a.c</span><br><span>+++ b/src/libmsc/ran_msg_a.c</span><br><span>@@ -1068,9 +1068,6 @@</span><br><span> </span><br><span>             .speech_version_used = n->speech_version_used,</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           .chosen_encryption_algorithm_serving =</span><br><span style="color: hsl(0, 100%, 40%);">-                  n->geran.chosen_encryption ? n->geran.chosen_encryption->alg_id : 0,</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>                .old_bss_to_new_bss_info_raw = n->old_bss_to_new_bss_info_raw,</span><br><span>            .old_bss_to_new_bss_info_raw_len = n->old_bss_to_new_bss_info_raw_len,</span><br><span> </span><br><span>@@ -1098,6 +1095,7 @@</span><br><span>                memcpy(r.encryption_information.key,</span><br><span>                        n->geran.chosen_encryption->key, n->geran.chosen_encryption->key_len);</span><br><span>            r.encryption_information.key_len = n->geran.chosen_encryption->key_len;</span><br><span style="color: hsl(120, 100%, 40%);">+         r.chosen_encryption_algorithm_serving = n->geran.chosen_encryption->alg_id;</span><br><span>    }</span><br><span> </span><br><span>        if (n->classmark)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13979">change 13979</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/13979"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I95051d0f02e2fdd3ec8da3a506109e7b23e99b4b </div>
<div style="display:none"> Gerrit-Change-Number: 13979 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>