<p><a href="https://gerrit.osmocom.org/12601">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/12601/1/openbsc/src/libmsc/smpp_openbsc.c">File openbsc/src/libmsc/smpp_openbsc.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/12601/1/openbsc/src/libmsc/smpp_openbsc.c@291">Patch Set #1, Line 291:</a> <code style="font-family:monospace,monospace">                } else {</code></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">I don't understand how it can be NULL, which is because I tried but failed to understand llist_for_each_entry()</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">It iterates over "smsc->esme_list", and puts each entry in "esme" as it runs the code in {} on each iteration.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Without looking much into the code that initializes smsc->esme_list, it seems that the whole osmo_esme struct gets zero-allocated. So esme->acl, like everything else in esme is NULL by default. At some later point, memory would get allocated for a full "struct osmo_smpp_acl" datatype (which is the datatype of esme->acl, see smpp_smsc.h), and the pointer to that new memory region would be placed in esme->acl. Then you are able to access it with esme->acl->foobar.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Now this alert_all_esme() function may run before or after esme->acl has been filled out, which is why we must check for it at that point.</p><p style="white-space: pre-wrap; word-wrap: break-word;">(Again, I am not familiar with the code, but that's my understanding of it.)</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">I feel a bit demoralised now that I patched a crash causing bug in there :(((</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">To be fair, this wasn't really obvious or otherwise it would have been catched in the review.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/12601">change 12601</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/12601"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: openbsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I2b52f2778b24eebc82b2e5e2fb3c2250b1f9e5b0 </div>
<div style="display:none"> Gerrit-Change-Number: 12601 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Keith Whyte <keith@rhizomatica.org> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Keith Whyte <keith@rhizomatica.org> </div>
<div style="display:none"> Gerrit-CC: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 12 Feb 2019 10:41:57 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>