pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/28520 )


Change subject: stream: assert params are not NULL in send/recv functions
......................................................................

stream: assert params are not NULL in send/recv functions

Change-Id: Ie9e67396973128aba87b584be1a36e2a94dd0998
---
M src/stream.c
1 file changed, 8 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/20/28520/1

diff --git a/src/stream.c b/src/stream.c
index 4379212..e6b731c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -870,6 +870,8 @@
  *  \param[in] msg Message buffer to enqueue in transmit queue */
 void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg)
 {
+       OSMO_ASSERT(cli);
+       OSMO_ASSERT(msg);
        msgb_enqueue(&cli->tx_queue, msg);
        osmo_fd_write_enable(&cli->ofd);
 }
@@ -881,6 +883,8 @@
 int osmo_stream_cli_recv(struct osmo_stream_cli *cli, struct msgb *msg)
 {
        int ret;
+       OSMO_ASSERT(cli);
+       OSMO_ASSERT(msg);

        ret = recv(cli->ofd.fd, msg->data, msg->data_len, 0);
        if (ret < 0) {
@@ -1448,6 +1452,8 @@
  *  \param[in] msg Message buffer to enqueue in transmit queue */
 void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
 {
+       OSMO_ASSERT(conn);
+       OSMO_ASSERT(msg);
        if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY) {
                LOGP(DLINP, LOGL_DEBUG, "Connection is being flushed and 
closed; ignoring new outgoing message\n");
                return;
@@ -1515,9 +1521,8 @@
 int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
 {
        int ret;
-
-       if (!msg)
-               return -EINVAL;
+       OSMO_ASSERT(conn);
+       OSMO_ASSERT(msg);

        switch (conn->srv->sk_domain) {
        case AF_UNIX:

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/28520
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie9e67396973128aba87b584be1a36e2a94dd0998
Gerrit-Change-Number: 28520
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to