From 3f58e1b3e79090f29f8b4b75bb529d54ba719c26 Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Mon, 9 Oct 2017 12:32:05 +0200 Subject: [PATCH] lib: fix a64448ba, invalid NULL->num_labels We should assume match OK only when neither nhl1 and neither nhl2 are NULL. If both are NULL, it means match NOK. Clang Warning: Access to field 'num_labels' results in a dereference of a null pointer (loaded from variable 'nhl1') Signed-off-by: Vincent Jardin --- lib/nexthop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nexthop.c b/lib/nexthop.c index ea6a310a4a..f6b2c9788d 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -128,7 +128,7 @@ int nexthop_labels_match(struct nexthop *nh1, struct nexthop *nh2) nhl1 = nh1->nh_label; nhl2 = nh2->nh_label; - if ((nhl1 && !nhl2) || (!nhl1 && nhl2)) + if (!nhl1 || !nhl2) return 0; if (nhl1->num_labels != nhl2->num_labels) -- 2.39.5