From 9e64ac4b7c23aa3b8b9149794c05305315cf31e5 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Fri, 16 Aug 2019 14:04:53 +0200 Subject: OSPF: Adding a note about a static analyzer result. --- proto/ospf/topology.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'proto/ospf') 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) && -- cgit v1.2.3