Re: kernel programming questions

David S. Miller (davem@jenolan.rutgers.edu)
Tue, 1 Jul 1997 11:25:03 -0400


Date: Tue, 1 Jul 1997 17:17:12 +0200 (MESZ)
From: Michael Weller <eowmob@exp-math.uni-essen.de>

On Tue, 1 Jul 1997, David S. Miller wrote:

> It's a more natural way of expressing alloca()....

Now, after this issue is settled, you allocate a dynamical array on
the stack, whose size might become unpredictable big (if it were
just 1 or 2 entries you could just allocate it statical).

I don't think the linux KERNEL stack can shrink and grow easily and
efficiently. Instead I'd assume you open Pandorra's box here by
allowing stack overflows at certain weird (and not necessarily
related to your code) occasions all over the kernel. Probably
allocating your array with kmalloc is more robust and stable
although more pain to code (esp. as you have to check for
allocation failure!)?

I didn't say it was a viable thing in the kernel, the original gripe
was that it was a "gcc feature" and "thou shal not" because of that
reason. It was a strawman, so I shot him down.

Later,
David "Sparc" Miller
davem@caip.rutgers.edu