forked from Mirror/frr
zebra: coverity fixes
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
273356eac5
commit
19631dcab5
|
@ -437,13 +437,19 @@ DEFPY_YANG (link_params_admin_grp,
|
||||||
char value_str[YANG_VALUE_MAXLEN];
|
char value_str[YANG_VALUE_MAXLEN];
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
|
assert(bitpattern);
|
||||||
|
|
||||||
if (bitpattern[0] != '0' || bitpattern[1] != 'x' ||
|
if (bitpattern[0] != '0' || bitpattern[1] != 'x' ||
|
||||||
strlen(bitpattern) > 10) {
|
strlen(bitpattern) > 10) {
|
||||||
vty_out(vty, "Invalid bitpattern value\n");
|
vty_out(vty, "Invalid bitpattern value\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf(bitpattern, "%x", &value);
|
if (sscanf(bitpattern, "%x", &value) != 1) {
|
||||||
|
vty_out(vty, "Invalid bitpattern value\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(value_str, sizeof(value_str), "%u", value);
|
snprintf(value_str, sizeof(value_str), "%u", value);
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, "./legacy-admin-group", NB_OP_MODIFY,
|
nb_cli_enqueue_change(vty, "./legacy-admin-group", NB_OP_MODIFY,
|
||||||
|
@ -610,6 +616,8 @@ DEFPY_YANG (link_params_res_bw,
|
||||||
float bw;
|
float bw;
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
|
assert(bandwidth);
|
||||||
|
|
||||||
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
||||||
vty_out(vty, "Invalid bandwidth value\n");
|
vty_out(vty, "Invalid bandwidth value\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
@ -647,6 +655,8 @@ DEFPY_YANG (link_params_ava_bw,
|
||||||
float bw;
|
float bw;
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
|
assert(bandwidth);
|
||||||
|
|
||||||
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
||||||
vty_out(vty, "Invalid bandwidth value\n");
|
vty_out(vty, "Invalid bandwidth value\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
@ -684,6 +694,8 @@ DEFPY_YANG (link_params_use_bw,
|
||||||
float bw;
|
float bw;
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
|
assert(bandwidth);
|
||||||
|
|
||||||
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
if (sscanf(bandwidth, "%g", &bw) != 1) {
|
||||||
vty_out(vty, "Invalid bandwidth value\n");
|
vty_out(vty, "Invalid bandwidth value\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
@ -817,6 +829,7 @@ DEFPY_YANG (ip_address,
|
||||||
strlcpy(ip, address_str, sizeof(ip));
|
strlcpy(ip, address_str, sizeof(ip));
|
||||||
|
|
||||||
mask = strchr(ip, '/');
|
mask = strchr(ip, '/');
|
||||||
|
assert(mask);
|
||||||
*mask = 0;
|
*mask = 0;
|
||||||
mask++;
|
mask++;
|
||||||
|
|
||||||
|
@ -886,6 +899,7 @@ DEFPY_YANG (ip_address_peer,
|
||||||
strlcpy(peer_ip, peer_str, sizeof(peer_ip));
|
strlcpy(peer_ip, peer_str, sizeof(peer_ip));
|
||||||
|
|
||||||
peer_mask = strchr(peer_ip, '/');
|
peer_mask = strchr(peer_ip, '/');
|
||||||
|
assert(peer_mask);
|
||||||
*peer_mask = 0;
|
*peer_mask = 0;
|
||||||
peer_mask++;
|
peer_mask++;
|
||||||
|
|
||||||
|
@ -934,6 +948,7 @@ DEFPY_YANG (ipv6_address,
|
||||||
strlcpy(ip, address_str, sizeof(ip));
|
strlcpy(ip, address_str, sizeof(ip));
|
||||||
|
|
||||||
mask = strchr(ip, '/');
|
mask = strchr(ip, '/');
|
||||||
|
assert(mask);
|
||||||
*mask = 0;
|
*mask = 0;
|
||||||
mask++;
|
mask++;
|
||||||
|
|
||||||
|
|
|
@ -2220,7 +2220,8 @@ int lib_interface_zebra_link_params_packet_loss_destroy(
|
||||||
static bool evpn_mh_dnode_to_esi(const struct lyd_node *dnode, esi_t *esi)
|
static bool evpn_mh_dnode_to_esi(const struct lyd_node *dnode, esi_t *esi)
|
||||||
{
|
{
|
||||||
if (yang_dnode_exists(dnode, "type-0/esi")) {
|
if (yang_dnode_exists(dnode, "type-0/esi")) {
|
||||||
str_to_esi(yang_dnode_get_string(dnode, "type-0/esi"), esi);
|
if (!str_to_esi(yang_dnode_get_string(dnode, "type-0/esi"), esi))
|
||||||
|
assert(false);
|
||||||
} else if (yang_dnode_exists(dnode, "type-3/system-mac") &&
|
} else if (yang_dnode_exists(dnode, "type-3/system-mac") &&
|
||||||
yang_dnode_exists(dnode, "type-3/local-discriminator")) {
|
yang_dnode_exists(dnode, "type-3/local-discriminator")) {
|
||||||
struct ethaddr mac;
|
struct ethaddr mac;
|
||||||
|
@ -2301,7 +2302,8 @@ int lib_interface_zebra_evpn_mh_type_0_esi_modify(struct nb_cb_modify_args *args
|
||||||
break;
|
break;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
str_to_esi(yang_dnode_get_string(args->dnode, NULL), &esi);
|
if (!str_to_esi(yang_dnode_get_string(args->dnode, NULL), &esi))
|
||||||
|
assert(false);
|
||||||
zebra_evpn_es_type0_esi_update(ifp->info, &esi);
|
zebra_evpn_es_type0_esi_update(ifp->info, &esi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3031,7 +3033,7 @@ int lib_interface_zebra_ipv6_router_advertisements_rdnss_rdnss_address_create(
|
||||||
struct nb_cb_create_args *args)
|
struct nb_cb_create_args *args)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct rtadv_rdnss rdnss, *p;
|
struct rtadv_rdnss rdnss = {0}, *p;
|
||||||
|
|
||||||
if (args->event != NB_EV_APPLY)
|
if (args->event != NB_EV_APPLY)
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
|
@ -3110,7 +3112,7 @@ int lib_interface_zebra_ipv6_router_advertisements_dnssl_dnssl_domain_create(
|
||||||
struct nb_cb_create_args *args)
|
struct nb_cb_create_args *args)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct rtadv_dnssl dnssl, *p;
|
struct rtadv_dnssl dnssl = {0}, *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
strlcpy(dnssl.name, yang_dnode_get_string(args->dnode, "domain"),
|
strlcpy(dnssl.name, yang_dnode_get_string(args->dnode, "domain"),
|
||||||
|
|
Loading…
Reference in a new issue