summaryrefslogtreecommitdiff
path: root/proto/ospf/topology.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2020-05-01 15:34:17 +0200
committerMaria Matejka <mq@ucw.cz>2020-05-01 15:34:17 +0200
commit048eb2ddf1ee9587d9fa30cbb3f87d6f650a2133 (patch)
treefdec4c5679a02c901cf2bc92fd81618c6f12d48e /proto/ospf/topology.c
parent17de3a023f7bde293892b41bfafe5740c8553fc8 (diff)
parent59238768b3b05fa134348d2232b42537d0403994 (diff)
Merge remote-tracking branch 'origin/mq-static-analysis'
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r--proto/ospf/topology.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 2e9c3965..c8ec730a 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -329,6 +329,14 @@ ospf_originate_lsa(struct ospf_proto *p, struct ospf_new_lsa *lsa)
en->next_lsa_opts = 0;
}
+ /* The static analyzer complains here that en->lsa_body may be NULL.
+ * Yes, it may if ospf_hash_get() creates a new struct top_hash_entry.
+ * In this case, also en->lsa.length must be 0 and lsa_length is never
+ * equal to 0 while sizeof(struct ospf_lsa_header) is non-zero.
+ * Therefore memcmp() is never executed with NULL here.
+ * */
+ ASSUME((en->lsa.length == 0) == (en->lsa_body == NULL));
+
/* Ignore the the new LSA if is the same as the current one */
if ((en->lsa.age < LSA_MAXAGE) &&
(lsa_length == en->lsa.length) &&