<p>Patch set 12:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.osmocom.org/11827">View Change</a></p><p>15 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11827/12/include/osmocom/gsm/gsm29_205.h">File include/osmocom/gsm/gsm29_205.h:</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/11827/12/include/osmocom/gsm/gsm29_205.h@1">Patch Set #12, Line 1:</a> <code style="font-family:monospace,monospace">/*! \defgroup gsm29205 3GPP TS 29.205</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">(if everything is calld 29205, then maybe also call the file 29205 without _ ... personally I get annoyed by typing gsm_08_08.c and gsm_04_08.c, gsm0808 is so much quicker, that's why my pref would be no underscores... if you agree.)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/include/osmocom/gsm/gsm29_205.h@32">Patch Set #12, Line 32:</a> <code style="font-family:monospace,monospace">/*! Parsed representation of Global Call Reference, 3GPP TS 29.205 Table B 2.1.9.1 */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/include/osmocom/gsm/gsm29_205.h@34">Patch Set #12, Line 34:</a> <code style="font-family:monospace,monospace">        uint8_t net[5];  /*< doc Network ID, ITU-T Q.1902.3 */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">doc</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c">File src/gsm/gsm29_205.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/11827/12/src/gsm/gsm29_205.c@37">Patch Set #12, Line 37:</a> <code style="font-family:monospace,monospace">/*! Create Global Call Reference</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@56">Patch Set #12, Line 56:</a> <code style="font-family:monospace,monospace">  msgb_lv_put(msg, 5, g->cr);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">(but to reduce magic numbers, maybe sizeof(g->cr)?)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@62">Patch Set #12, Line 62:</a> <code style="font-family:monospace,monospace">/*! Decode Global Call Reference, 3GPP TS 29.205 Table B 2.1.9.1</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@72">Patch Set #12, Line 72:</a> <code style="font-family:monospace,monospace">         return -EBADMSG;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">(I guess would also be -EINVAL?)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@79">Patch Set #12, Line 79:</a> <code style="font-family:monospace,monospace">       parsed += (gcr->net_len + 1);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">net_len is what you just parsed, and the +1?</p><p style="white-space: pre-wrap; word-wrap: break-word;">If +1 is the following len, then parse and check that instead of ignoring</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@84">Patch Set #12, Line 84:</a> <code style="font-family:monospace,monospace">       if (elem[parsed - 1] != 5) /* see Table B 2.1.9.2 */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">it's weird to first add +1 and then do -1 again. Rather drop the +1 above, then parse the len at elem[parsed], and then +1 after that.</p><p style="white-space: pre-wrap; word-wrap: break-word;">(nice to use sizeof instead of magic)</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/src/gsm/gsm29_205.c@85">Patch Set #12, Line 85:</a> <code style="font-family:monospace,monospace">         return -ENOENT;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">I guess would also be -EINVAL?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11827/12/tests/gsm29205/gsm29205_test.c">File tests/gsm29205/gsm29205_test.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/11827/12/tests/gsm29205/gsm29205_test.c@41">Patch Set #12, Line 41:</a> <code style="font-family:monospace,monospace">          0x46, 0x46, 0x46, 0x46, 0x46 /* .cr - Call. Ref. */</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">vary byte values</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/tests/gsm29205/gsm29205_test.c@45">Patch Set #12, Line 45:</a> <code style="font-family:monospace,monospace"> struct gsm29205_gcr g = { .net_len = 3, .node = 0xDEAD }, p = { 0 };</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">= {}</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/tests/gsm29205/gsm29205_test.c@53">Patch Set #12, Line 53:</a> <code style="font-family:monospace,monospace">    memset(g.net, 'U', g.net_len);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">vary bytes</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/tests/gsm29205/gsm29205_test.c@59">Patch Set #12, Line 59:</a> <code style="font-family:monospace,monospace">    if (!msgb_cmp_data_print(msg, res, ARRAY_SIZE(res)))</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">cmp() == 0 means match</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11827/12/tests/gsm29205/gsm29205_test.c@64">Patch Set #12, Line 64:</a> <code style="font-family:monospace,monospace">          printf("decoding failed: %s [%s]\n", strerror(-rc), msgb_hexdump(msg));</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">abort(): it does not make sense to parse network id length and so on if not even the p got populated</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/11827">change 11827</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/11827"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Iee95aa4e5c056645b6cb5667e4a067097d52dfbf </div>
<div style="display:none"> Gerrit-Change-Number: 11827 </div>
<div style="display:none"> Gerrit-PatchSet: 12 </div>
<div style="display:none"> Gerrit-Owner: Max <msuraev@sysmocom.de> </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: Max <msuraev@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 30 Nov 2018 16:15:25 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>