diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2018-10-01 17:41:08 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-01 17:02:02 +0000 |
commit | 5df628bb8a30b69f223a7c8b017dcba770c87e43 (patch) | |
tree | 8c899496bf260fc33d5c2100ed43b7d9393e85df /src/vat/api_format.c | |
parent | c3a06556d1a4a63646d4cc7aa76274177a56c13f (diff) |
vat: fix coverity warning for show_threads
Change-Id: I8c226b91cc45f6f345444afd8d168e1292371582
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r-- | src/vat/api_format.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 583185e4d5f..96a79bf251b 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -1347,10 +1347,14 @@ static void vl_api_show_threads_reply_t_handler_json vat_main_t *vam = &vat_main; vat_json_node_t node; vl_api_thread_data_t *td; - int i, count = ntohl (mp->count); + i32 retval = ntohl (mp->retval); + int i, count = 0; + + if (retval >= 0) + count = ntohl (mp->count); vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); + vat_json_object_add_int (&node, "retval", retval); vat_json_object_add_uint (&node, "count", count); for (i = 0; i < count; i++) @@ -1368,7 +1372,7 @@ static void vl_api_show_threads_reply_t_handler_json vat_json_print (vam->ofp, &node); vat_json_free (&node); - vam->retval = ntohl (mp->retval); + vam->retval = retval; vam->result_ready = 1; } |