I have a question about assert() in Linux: can I use it in the kernel?
assert()
If no, what techniques do you usually use if, for example I don\'t want to enter NULL
One option would be to use the macro BUG_ON(). It will printk a message, and then panic() (i.e. crash) the kernel.
BUG_ON()
printk
panic()
http://kernelnewbies.org/KernelHacking-HOWTO/Debugging_Kernel
Of course, this should only be used as an error handling strategy of last resort (just like assert)...
assert