diff options
author | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-10-27 11:36:00 +0200 |
---|---|---|
committer | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-10-27 12:58:18 +0200 |
commit | b6467a4274df734c5a5d1bf4cf9ab5c6d0b8a475 (patch) | |
tree | d1381bb3b97efab7742c55e28e7de9a1e7b5c773 /pimd/pim_nht.c | |
parent | pimd: Unchecked return value (diff) | |
download | frr-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.c | 5 |
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)); |