Re: NULL Pointer Dereference Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Sesterhenn / Snakebyte wrote:
> hi,
>
> coverity reports a lot of REVERSE_INULL bugs of the following type
> ( example from drivers/char/synclink.c )
>
> [snip]
>
> Are these really an issue? 
Most of the reported REVERSE NULLs are not, but for a different reason
than what you state below: the pointer really cannot be NULL but
Coverity gets confused by the explicit NULL check in the code and
assumes it can be. To be able to fix these, you first need to determine
whether the bug is valid (the pointer can be NULL when dereferenced -
and since this depends upon the invocation path/parameters, it can get
quite tricky and may require intimate subsystem knowledge). If it can
be, then you have a real bug and should move the dereference after the
check. If it can't be, then the NULL check is redundant and may be removed.

> We just read from strange memory locations,
> but never write to them as far as i can see. In userspace reading
> from adress 0 usually segfaults, but i was unable to produce an
> oops or bug with a kernel module by doing so. 
I guess you didn't try hard enough ;) Try googling "Unable to handle
kernel NULL pointer dereference".

Dereferencing a NULL pointer in kernel will definitely trigger an
exception (it's not just a "strange" memory location, it's a purposely
invalid virtual address) and cause problems (at the very least you get
an oops but worse things can happen).

---
fm

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux