Re: don't let mmap allocate down to zero

From: Chris Friesen
Date: Wed Jan 26 2005 - 21:05:08 EST


linux-os wrote:

The seg-fault you get when you de-reference a pointer to NULL
is caused by the kernel. You are attempting to access memory
that has not been mapped into your address space. Once that
memory gets mmap()ed, you will no longer get a seg-fault.
Again, the seg-fault has nothing to do with 'C'. It's an
implementation behavior that can be changed with mmap().

The segfault *does* have something to do with C. The standard says that the result of dereferencing a NULL pointer is *undefined*. Not implementation-defined, but undefined. Anything relying on dereferencing NULL pointers is not valid C code.

Chris
-
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/