]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
OSPF: Adding a note about a static analyzer result.
authorMaria Matejka <mq@ucw.cz>
Fri, 16 Aug 2019 12:04:53 +0000 (14:04 +0200)
committerMaria Matejka <mq@ucw.cz>
Fri, 1 May 2020 13:19:12 +0000 (15:19 +0200)
proto/ospf/topology.c

index 2e9c39655f381481bb2a12fe33ca43277efb12a7..c8ec730a1e44d581bb2da4827e069c35ebf78292 100644 (file)
@@ -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) &&