<p>Stefan Sperling has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11730">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix bogus error check in gprs_sndcp_comp_create()<br><br>The function gprs_sndcp_get_compression_class() returns -EINVAL<br>upon error, not -1, so an existing assertion would never trigger.<br><br>Instead, check for the values we want first (PROTOCOL_COMP or<br>DATA_COMP) and assert(false) in case the returned value doesn't<br>match either of these.<br><br>Found by: Neels<br><br>Change-Id: I8444c1ed052707c76a979fb06cb018ac678defa7<br>---<br>M src/gprs/gprs_sndcp_comp.c<br>1 file changed, 4 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/30/11730/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gprs/gprs_sndcp_comp.c b/src/gprs/gprs_sndcp_comp.c</span><br><span>index 60b15b9..3e02603 100644</span><br><span>--- a/src/gprs/gprs_sndcp_comp.c</span><br><span>+++ b/src/gprs/gprs_sndcp_comp.c</span><br><span>@@ -92,19 +92,20 @@</span><br><span>        * (Protocol or Data compresson ?) */</span><br><span>        comp_entity->compclass = gprs_sndcp_get_compression_class(comp_field);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   OSMO_ASSERT(comp_entity->compclass != -1);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>        /* Create an algorithm specific compression context */</span><br><span>       if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION) {</span><br><span>           if (gprs_sndcp_pcomp_init(ctx, comp_entity, comp_field) != 0) {</span><br><span>                      talloc_free(comp_entity);</span><br><span>                    comp_entity = NULL;</span><br><span>          }</span><br><span style="color: hsl(0, 100%, 40%);">-       } else {</span><br><span style="color: hsl(120, 100%, 40%);">+      } else if (comp_entity->compclass == SNDCP_XID_DATA_COMPRESSION) {</span><br><span>                if (gprs_sndcp_dcomp_init(ctx, comp_entity, comp_field) != 0) {</span><br><span>                      talloc_free(comp_entity);</span><br><span>                    comp_entity = NULL;</span><br><span>          }</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              /* comp_field is somehow invalid */</span><br><span style="color: hsl(120, 100%, 40%);">+           OSMO_ASSERT(false);</span><br><span>  }</span><br><span> </span><br><span>        /* Bail on failure */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11730">change 11730</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/11730"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sgsn </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8444c1ed052707c76a979fb06cb018ac678defa7 </div>
<div style="display:none"> Gerrit-Change-Number: 11730 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>