Re: [PATCH] fs/devfs/base.c

Linus Torvalds (torvalds@transmeta.com)
Sun, 3 Jun 2001 16:55:00 -0700 (PDT)


On Sun, 27 May 2001, Richard Gooch wrote:
>
> I absolutely don't want this patch applied. It's bogus. It is entirely
> safe to alloc 1 kB on the stack in this code, since it has a short and
> well-controlled code path from syscall entry to the function.

IT IS NEVER EVER SAFE TO ALLOCATE 1kB OF STACK!

Why?
- automatic checkers are wonderful, and we do not want to have "oh, in
this case it is magically ok" kinds of things.
- the kernel stack is 4kB, and _nobody_ has the right to eat up a
noticeable portion of it. It doesn't matter if you "know" your caller
or not: you do not know what interrupts happen during this time, and
how much stack they want.

Ergo: the simple rule of "don't allocate big structures of the stack" is
always a good rule, and making excuses for it is bad.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/