<p></p>
<p><b>@benpicco</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/16494#discussion_r688926068">sys/net/gnrc/sock/tcp/gnrc_sock_tcp.c</a>:</p>
<pre style='color:#555'>> +
+    /* Map SOCK_NO_TIMEOUT to 0. 0 is used in GNRC_TCP for no timeout */
+    if (timeout == SOCK_NO_TIMEOUT) {
+        timeout = 0;
+    }
+
+    /* Forward call to gnrc_tcp_recv: All error codes share the same semantics */
+    return gnrc_tcp_recv(sock, data, max_len, timeout);
+}
+
+ssize_t sock_tcp_write(sock_tcp_t *sock, const void *data, size_t len)
+{
+    /* Asserts defined by API. */
+    assert(sock != NULL);
+    assert(data != NULL);
+    assert(len > 0);
</pre>
<blockquote>
<p>The entire use case is nonsense and i am not sure is gnrc_tcp handles it correctly.</p>
</blockquote>
<p>I can easily imagine a loop like</p>
<div class="highlight highlight-source-c"><pre><span class="pl-k">int</span> res;
<span class="pl-k">while</span> ((res = gnrc_tcp_recv(tcb, data, data_len, <span class="pl-c1">0</span>) {
    data += res;
    data_len -= res;
}</pre></div>
<p>That shouldn't trigger an assertion when <code>data_len</code> reaches 0. Same for <code>gnrc_tcp_send()</code>.</p>
<p>The API also does not specify that the number of bytes to those functions must not be zero.</p>
<p>On Linux I can <code>read()</code> 0 bytes without causing a kernel panic <g-emoji class="g-emoji" alias="wink" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f609.png">😉</g-emoji></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16494#discussion_r688926068">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYGIKGICDDWA6OAQOOLT4ZPXXANCNFSM45KSNSZA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/ABE7WYEEQ3MEUMDU6BC6QFTT4ZPXXA5CNFSM45KSNSZKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFOCFC6A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16494#discussion_r688926068",
"url": "https://github.com/RIOT-OS/RIOT/pull/16494#discussion_r688926068",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>