Subject: Bug in usr/src/sys/net/radix.c on 3.0?
To: None <>
From: Markus Mayer <>
List: tech-kern
Date: 05/04/2006 10:25:02

I just noticed looking at the code in radix.c that there seems to be the 
possibility that this module may not initialize properly:

	char *cp, *cplim;
#ifdef _KERNEL
	static int initialized;
	__link_set_decl(domains, struct domain);
	struct domain *const *dpp;

	if (initialized)
	initialized = 1;

The static variable 'initialized' is never explicitly set to 0 in the 
beginning. Hence it is possible that 'initialized' has a value other 
than 0 when the system starts up and thus the 'if' statement might be 
true even though the rest of the code has never been executed.

I am suggesting to do something like this:

diff -u -r1.28 radix.c
--- radix.c     26 Feb 2005 22:45:09 -0000      1.28
+++ radix.c     4 May 2006 17:19:09 -0000
@@ -945,7 +945,7 @@
         char *cp, *cplim;
  #ifdef _KERNEL
-       static int initialized;
+       static int initialized = 0;
         __link_set_decl(domains, struct domain);
         struct domain *const *dpp;