How do I debug a kernel module in which a NULL pointer appears?

First things first, debug the module? Just see if you can load it up in gdb it might point you straight at a line that uses the relevant variable(or close to it).

oh, and you might find this article useful


I'm one of the authors of that patch, sorry it is so buggy :)

In general to find null pointers like this I just insert printks until I find the pointer that is null (=0), then I read the source code until I find out why.

However in this case I know that you have to disable framebuffer console or you'll get this nasty bug, which is only triggered when the console is visible. Or it could be the bug triggered when you unplug the keyboard, and the module still tries to write to the now invalid buffer.

You should check out the new code on github, which I am attempting to clean up right now, to make it easier to compile against arbitrary kernels, and which has quite a few bug fixes.

Also, drop by our IRC, #lg4l on freenode.