Re: Null pointer exception for local variables in stack with C++kernel modules

From: Bernhard Walle
Date: Tue Jan 04 2011 - 17:10:50 EST


Hello Leo,

Am 04.01.11 20:46, schrieb Leo Prasath:
>
> I have integrated a C++ codebase which uses minimalistic features of c
> and followed the guidelines in
> http://pograph.wordpress.com/2009/04/05/porting-cpp-code-to-linux-kernel/
> to integrate with an existing C linux kernel module.
> It all works fine except for occassional very very weird NULL pointer
> exceptions.

Wild guess: Stack overflow. In the kernel the stack is very limited
(depends on the configuration and IIRC on the archtecture, but 4K is the
minimum IIRC) and in C++ it's possible and common to put larger objects
on the stack.

However, C++ isn't supported by the kernel developers and you're on your
own. Rewrite the code to use plain C.


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