Skip to contentSkip to conversation

increase MAXNEST constant

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 21, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 increase MAXNEST constant

The MAXNEST constant in sparse is currently too small for checking most of the kernel files. The deepest nesting I found in the kernel is 25, so MAXNEST=32 should probably be sufficient. It would be nice to check overruns here, but I did not know where to best do it.

The problem is hidden when sparse is compiled with gcc-3.2 or earlier, but causes segmentation faults with gcc-3.3.

	Arnd <><

===== pre-process.c 1.65 vs edited =====

pre-process.c +1 -1
@@ -28,7 +28,7 @@
 int verbose = 0;
 int preprocessing = 0;
 
-#define MAXNEST (16)
+#define MAXNEST (32)
 static int true_nesting = 0;
 static int false_nesting = 0;
 static struct token *unmatched_if = NULL;
#1 lore raw
Quoted 3 lines · Arnd Bergmann

The MAXNEST constant in sparse is currently too small for checking most of the kernel files.

Thanks, right you are. I fixed it a bit differently, in particular it doesn't need an "int", it really needs just one bit per level, but I left it at "char" instead.

Quoted 4 lines

The deepest nesting
I found in the kernel is 25, so MAXNEST=32 should probably be sufficient. It would be nice to check overruns here, but I did not know where to best do it.

I did that too (and I made the size of the nesting be 256, since changing it to a char means that it's fairly small).

Linus