aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vlibapi/vat_helper_macros.h12
-rw-r--r--src/vlibmemory/socket_client.c6
2 files changed, 10 insertions, 8 deletions
diff --git a/src/vlibapi/vat_helper_macros.h b/src/vlibapi/vat_helper_macros.h
index 5e7f1083947..fd2e563512f 100644
--- a/src/vlibapi/vat_helper_macros.h
+++ b/src/vlibapi/vat_helper_macros.h
@@ -77,12 +77,14 @@ do { \
socket_client_main_t *scm = &vam->socket_client_main; \
if (scm->socket_enable) \
{ \
- msgbuf_t msgbuf; \
- \
- msgbuf.q = 0; \
- msgbuf.gc_mark_timestamp = 0; \
- msgbuf.data_len = ntohl(scm->socket_tx_nbytes); \
+ msgbuf_t msgbuf = \
+ { \
+ .q = 0, \
+ .gc_mark_timestamp = 0, \
+ .data_len = htonl(scm->socket_tx_nbytes), \
+ }; \
\
+ /* coverity[UNINIT] */ \
n = write (scm->socket_fd, &msgbuf, sizeof (msgbuf)); \
if (n < sizeof (msgbuf)) \
clib_unix_warning ("socket write (msgbuf)"); \
diff --git a/src/vlibmemory/socket_client.c b/src/vlibmemory/socket_client.c
index 8519e7f5f7c..b60fd4f6229 100644
--- a/src/vlibmemory/socket_client.c
+++ b/src/vlibmemory/socket_client.c
@@ -166,16 +166,16 @@ vl_socket_client_connect (socket_client_main_t * scm, char *socket_path,
mbp = (msgbuf_t *) buffer;
mbp->q = 0;
- mbp->data_len = ntohl (sizeof (*mp));
+ mbp->data_len = htonl (sizeof (*mp));
mbp->gc_mark_timestamp = 0;
mp = (vl_api_sockclnt_create_t *) mbp->data;
- mp->_vl_msg_id = ntohs (VL_API_SOCKCLNT_CREATE);
+ mp->_vl_msg_id = htons (VL_API_SOCKCLNT_CREATE);
strncpy ((char *) mp->name, client_name, sizeof (mp->name) - 1);
mp->name[sizeof (mp->name) - 1] = 0;
mp->context = 0xfeedface;
- n = write (scm->socket_fd, mbp, sizeof (*mbp) + ntohl (mbp->data_len));
+ n = write (scm->socket_fd, mbp, sizeof (*mbp) + sizeof (*mp));
if (n < 0)
{
clib_unix_warning ("socket write (msg)");