diff options
| author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-09-03 15:10:21 -0400 |
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 11:13:43 -0400 |
| commit | e9f6516243f58a856bc467a2ca95730cb7cabfc7 (patch) | |
| tree | 5fece1ff8974c1f52b28434164a7b8f7ba6eadc4 | |
| parent | 9c387098eb147a628857982639258cf7d4d9a090 (diff) | |
zebra: Fix NULL check in zebra_nhg_rib_find()
Check both the nhg and nexthop are not NULL before passing
them to be hashed. Clang SA caught this.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| -rw-r--r-- | zebra/zebra_nhg.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 8cc1877106..8fb4f3357b 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1033,15 +1033,13 @@ zebra_nhg_rib_find(uint32_t id, struct nexthop_group *nhg, afi_t rt_afi) { struct nhg_hash_entry *nhe = NULL; - vrf_id_t nhg_vrf_id = nhg->nexthop->vrf_id; - - if (!nhg) { + if (!(nhg && nhg->nexthop)) { flog_err(EC_ZEBRA_TABLE_LOOKUP_FAILED, "No nexthop passed to %s", __func__); return NULL; } - zebra_nhg_find(&nhe, id, nhg, NULL, nhg_vrf_id, rt_afi, 0); + zebra_nhg_find(&nhe, id, nhg, NULL, nhg->nexthop->vrf_id, rt_afi, 0); return nhe; } |
