Linux Kernel Programming: "Unable to handle kernel NULL pointer dereference"
NickName:Daniel Silveira Ask DateTime:2008-12-05T01:25:08

Linux Kernel Programming: "Unable to handle kernel NULL pointer dereference"

I'm writing a Linux module and getting:

Unable to handle kernel NULL pointer dereference

What does it mean?

Copyright Notice:Content Author:「Daniel Silveira」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/341422/linux-kernel-programming-unable-to-handle-kernel-null-pointer-dereference

Answers
Nathan 2008-12-04T17:28:36

Sounds like a pointer which currently has the NULL value (zero) is being dereferenced. Assign an address to the pointer before dereferencing it.\n\ne.g.\n\nint x = 5;\nint * x_ptr = NULL;\n\nx_ptr = &x; // this line may be missing in your code\n\n*x_ptr += 5; //can't dereference x_ptr here if x_ptr is still NULL\n",


Johannes Schaub - litb 2008-12-04T17:31:46

The kernel tries to read from address 0, which your kernel apparently treats specially (good thing!). As the kernel has no way to just kill itself like we know from user mode applications (those would have received a Segmentation Fault), this error is fatal. It will have probably panic'ed and displayed that message to you.\n\n\n\nhttp://en.wikipedia.org/wiki/Null_pointer#The_null_pointer",


More about “Linux Kernel Programming: "Unable to handle kernel NULL pointer dereference"” related questions

Learning Linux Kernel programming on a virtual machine on Ubuntu?

I am just learning linux kernel programming with the LINUX KERNEL DEVELOPMENT book(I am beginner linux kernel programming but not on linux programming). It is possible to test programs in a kernel

Show Detail

where to start linux kernel programming?

I have been programming in C for a couple of years in Linux. Now I want to work on linux kernel and contribute to kernel, if possible. I have been looking on the internet for the information about a

Show Detail

How to determine the wordsize in Linux kernel programming?

In userspace code, the macro __WORDSIZE is used, included in <bits/wordsize.h>. However, when I do Linux kernel programming, the __WORDSIZE seems not available. If <bits/wordsize.h> is

Show Detail

Usage of libC in linux kernel and standalone programming

We can use standard C library routines in standalone micro-controller programming but we cant in linux kernel. my question is, in both cases while they are running on the target hardware both of them

Show Detail

How are device driver development and linux kernel programming related/different?

This might be a stupid question but I am confused and google couldn't help. I know Linux is the Kernel which is the heart of many distros( Ubuntu, Mint). But when we say "Linux kernel programming"...

Show Detail

Linux kernel programming on threads for kernel version 3.x

I would like to know where can I find good tutorial or examples for linux kernel programming on threading for kernel 3.x? Any help would be appreciated.....

Show Detail

Capture TCP packet in linux kernel programming

I am working on Linux(ubuntu 14.04). I want some typical information about linux kernel programming. In TCP Communication, when the linux kernel is creating a packet by encapsulating headers, I wa...

Show Detail

Best linux distribution to do Kernel Module programming

I want to do kernel module programming. But, all sources tell that linux distributions patch the original kernel and that module codes might not run on them. If this is true, what should i do.I tried

Show Detail

Linux kernel programming: can't include header file

I am new in programming kernel linux , I'm trying to program in the linux kernel a function to find the number of processors in the system and I find this. #include <linux/kernel.h> #include...

Show Detail

Linux Kernel installation

I am learning kernel programming and want to write/test modules in the kernel, do some development, etc. I have a Linux box with the latest Ubuntu on it. My basic question is this: Should I instal...

Show Detail