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>
This commit is contained in:
Sai Gomathi N 2022-10-27 02:36:00 -07:00
parent f13530f23a
commit b6467a4274

View File

@ -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));