2003-06-21 11:41:30

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] [SPARSE] 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 =====
--- 1.65/pre-process.c Wed Jun 11 01:03:25 2003
+++ edited/pre-process.c Sat Jun 21 13:26:03 2003
@@ -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;


2003-06-21 16:51:53

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] [SPARSE] increase MAXNEST constant


On Sat, 21 Jun 2003, Arnd Bergmann wrote:
>
> 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.

> 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