From f96c2b6dc2323835f88cd3a81500a68adc5619ee Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 19 May 2021 15:53:16 +0300 Subject: [PATCH 1/2] lib: fix coverity warnings CID 1504894 Signed-off-by: Igor Ryzhov --- lib/northbound.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/northbound.c b/lib/northbound.c index 3634fed04f..6988fd9a9c 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -599,6 +599,7 @@ static void nb_config_diff(const struct nb_config *config1, * the diff tree. */ target = yang_dnode_get(config2->dnode, path); + assert(target); nb_config_diff_created(target, &seq, changes); /* Skip rest of sub-tree, move to next sibling @@ -607,6 +608,7 @@ static void nb_config_diff(const struct nb_config *config1, break; case 'd': /* delete */ target = yang_dnode_get(config1->dnode, path); + assert(target); nb_config_diff_deleted(target, &seq, changes); /* Skip rest of sub-tree, move to next sibling From 3558b8b8b46bd7907c7d7b66b63aa0f5fe63ddb0 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 19 May 2021 16:24:21 +0300 Subject: [PATCH 2/2] pbrd: fix coverity warning CID 1500586 There was an attempt to fix it in 920bb6f7 but the commit didn't actually fix the warning. Signed-off-by: Igor Ryzhov --- pbrd/pbr_nht.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index e127999b0b..301550deb7 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -721,7 +721,7 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc, * So let's search and do the right thing on the * interface event. */ - if (!pnhi->nhr && pnhi->ifp) { + if (!pnhi->nhr) { switch (pnhc->nexthop.type) { case NEXTHOP_TYPE_BLACKHOLE: case NEXTHOP_TYPE_IPV4: @@ -738,20 +738,18 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc, goto done; } - if (pnhi->nhr) { - switch (pnhi->nhr->prefix.family) { - case AF_INET: - if (pnhc->nexthop.gate.ipv4.s_addr - != pnhi->nhr->prefix.u.prefix4.s_addr) - goto done; /* Unrelated change */ - break; - case AF_INET6: - if (memcmp(&pnhc->nexthop.gate.ipv6, - &pnhi->nhr->prefix.u.prefix6, 16) - != 0) - goto done; /* Unrelated change */ - break; - } + switch (pnhi->nhr->prefix.family) { + case AF_INET: + if (pnhc->nexthop.gate.ipv4.s_addr + != pnhi->nhr->prefix.u.prefix4.s_addr) + goto done; /* Unrelated change */ + break; + case AF_INET6: + if (memcmp(&pnhc->nexthop.gate.ipv6, + &pnhi->nhr->prefix.u.prefix6, 16) + != 0) + goto done; /* Unrelated change */ + break; } pnhi->nhr_matched = true;