On Fri, 1 Jun 2007, Andrew Morton wrote:

> I think it'd be better if we kept the WARN_ON_ONCE(size == 0) in there,

The trouble with the WARN_ON is that it triggers even for code that is 
okay like noted by Jeremy. My initial intend with NULL was to allow the 
allocation of a zero sized pointer without extra checks. It should only
trigger a failure if something bad was done.

NULL had the problem of confusion with no memory available. I think BADPTR 
is good. If the coding warts are causing trouble then BADPTR will result 
in a failure. Otherwise if the code is doing a kmalloc(0) and not 
dereferencing the pointer (like Paul's fixed code) then we should be fine 
and not issue a warning.

The false positives may be upsetting some people.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to