[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stack overflow problem in kernel module
Hi Folks,
I'm about to ask a potentially stupid question, so I request you to be
patient with me, and if I'm missing something and need to read up on
it, please do point me to appropriate material :-).
I'm writing a test suite for a kernel module, and am facing this problem:
I have a function say foobar().
The moment I declare a big array inside the function, like below, it
causes the kernel to crash
anytime I call the function.
int foobar (int args)
{
/* local var declarations */
char somebuffer[1024];
/* rest of the function */
}
I was told that it's bad design to use local variables that are as
huge as this in kernel modules - so my questions are:
1. Why is it a bad idea to use huge local arrays in kernel modules?
2. When the kernel crashed, what followed on screen mentioned a stack
overflow. How can I find out how much stack area I have, and whether
or not a particular function can potentially cause stack overflow?
Thanks for your patience and your help :-)
Regards,
Karthik.
--
There are things known and things unknown, in between lie the Doors
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/