summaryrefslogtreecommitdiffstats
path: root/src/vat2/jsonconvert.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-02-17 14:10:04 +0100
committerNeale Ranns <neale@graphiant.com>2021-02-18 08:18:46 +0000
commit71134f26a15f3d6b055dc122d050d71f8b8d3ed0 (patch)
tree07503f5d5a19722718be9fae2602752e85db17f7 /src/vat2/jsonconvert.c
parent919654c07bb8fd2df30110220bbcc74fd3a40d01 (diff)
vat2: jsonconvert return checking - coverity
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I8348645927519800d2390d27e01fae612602a6eb
Diffstat (limited to 'src/vat2/jsonconvert.c')
-rw-r--r--src/vat2/jsonconvert.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/vat2/jsonconvert.c b/src/vat2/jsonconvert.c
index d62cda1091c..645f7d4ca20 100644
--- a/src/vat2/jsonconvert.c
+++ b/src/vat2/jsonconvert.c
@@ -270,7 +270,8 @@ vl_api_ip4_address_t_fromjson (void **mp, int *len, cJSON *o,
if (!p)
return -1;
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "%U", unformat_ip4_address, a);
+ if (!unformat (&input, "%U", unformat_ip4_address, a))
+ return -1;
return 0;
}
@@ -283,7 +284,9 @@ vl_api_ip4_prefix_t_fromjson (void **mp, int *len, cJSON *o,
if (!p)
return -1;
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "%U/%d", unformat_ip4_address, &a->address, &a->len);
+ if (!unformat (&input, "%U/%d", unformat_ip4_address, &a->address,
+ &a->len))
+ return -1;
return 0;
}
@@ -302,7 +305,8 @@ vl_api_ip6_address_t_fromjson (void **mp, int *len, cJSON *o,
if (!p)
return -1;
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "%U", unformat_ip6_address, a);
+ if (!unformat (&input, "%U", unformat_ip6_address, a))
+ return -1;
return 0;
}
@@ -315,7 +319,8 @@ vl_api_ip6_prefix_t_fromjson (void **mp, int *len, cJSON *o,
if (!p)
return -1;
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "%U/%d", unformat_ip6_address, &a->address, &a->len);
+ if (!unformat (&input, "%U/%d", unformat_ip6_address, &a->address, &a->len))
+ return -1;
return 0;
}
@@ -408,7 +413,8 @@ vl_api_mac_address_t_fromjson (void **mp, int *len, cJSON *o,
char *p = cJSON_GetStringValue(o);
unformat_init_string (&input, p, strlen(p));
- unformat(&input, "%U", unformat_mac_address, a);
+ if (!unformat (&input, "%U", unformat_mac_address, a))
+ return -1;
return 0;
}
@@ -438,16 +444,6 @@ format_vl_api_interface_index_t (u8 *s, va_list *args)
return format (s, "%u", *a);
}
-uword
-unformat_vl_api_interface_index_t (unformat_input_t * input, va_list * args)
-{
- u32 *a = va_arg (*args, u32 *);
-
- if (!unformat (input, "%u", a))
- return 0;
- return 1;
-}
-
void
vl_api_string_cJSON_AddToObject(cJSON * const object, const char * const name, vl_api_string_t *astr)
{