summaryrefslogtreecommitdiff
path: root/pimd/pim6_mld.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-04-21 07:38:11 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-04-21 07:38:11 -0400
commit35801e6234fec8c62094e4c9cc8400b5942d013e (patch)
tree15921c087044b4849835b2d2bb26de0cea5570ea /pimd/pim6_mld.c
parentdb865bf6ed708e087eaef18d89f458044582cac4 (diff)
pimd: Tell coverity what is really going on
Fix a code path that coverity has decided a variable is NULL when it never can be. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'pimd/pim6_mld.c')
-rw-r--r--pimd/pim6_mld.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c
index e74707b522..74cd729d44 100644
--- a/pimd/pim6_mld.c
+++ b/pimd/pim6_mld.c
@@ -2471,6 +2471,19 @@ static void gm_show_if_vrf(struct vty *vty, struct vrf *vrf, const char *ifname,
if (js) {
js_if = json_object_new_object();
+ /*
+ * If we have js as true and detail as false
+ * and if Coverity thinks that js_if is NULL
+ * because of a failed call to new then
+ * when we call gm_show_if_one below
+ * the tt can be deref'ed and as such
+ * FRR will crash. But since we know
+ * that json_object_new_object never fails
+ * then let's tell Coverity that this assumption
+ * is true. I'm not worried about fast path
+ * here at all.
+ */
+ assert(js_if);
json_object_object_add(js_vrf, ifp->name, js_if);
}