summaryrefslogtreecommitdiffstats
path: root/pimd/pim_nht.c
diff options
context:
space:
mode:
authorSai Gomathi N <nsaigomathi@vmware.com>2022-10-27 11:36:00 +0200
committerSai Gomathi N <nsaigomathi@vmware.com>2022-10-27 12:58:18 +0200
commitb6467a4274df734c5a5d1bf4cf9ab5c6d0b8a475 (patch)
treed1381bb3b97efab7742c55e28e7de9a1e7b5c773 /pimd/pim_nht.c
parentpimd: Unchecked return value (diff)
downloadfrr-b6467a4274df734c5a5d1bf4cf9ab5c6d0b8a475.tar.xz
frr-b6467a4274df734c5a5d1bf4cf9ab5c6d0b8a475.zip
pimd: Dereference before null check
In pim_ecmp_nexthop_search: All paths that lead to this null pointer comparison already dereference the pointer earlier There may be a null pointer dereference, or else the comparison against null is unnecessary. Coverity CID-1519749 Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
Diffstat (limited to 'pimd/pim_nht.c')
-rw-r--r--pimd/pim_nht.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 9feb064e9..f9a9aeb1b 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -495,12 +495,13 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim,
uint32_t hash_val = 0, mod_val = 0;
uint8_t nh_iter = 0, found = 0;
uint32_t i, num_nbrs = 0;
- pim_addr nh_addr = nexthop->mrib_nexthop_addr;
- pim_addr grp_addr = pim_addr_from_prefix(grp);
if (!pnc || !pnc->nexthop_num || !nexthop)
return 0;
+ pim_addr nh_addr = nexthop->mrib_nexthop_addr;
+ pim_addr grp_addr = pim_addr_from_prefix(grp);
+
memset(&nbrs, 0, sizeof(nbrs));
memset(&ifps, 0, sizeof(ifps));