Re: [RFC] [PATCH] cpuset operations causes Badness at mm/slab.c:777 warning

Christoph Lameter
2007-06-02T00:26:17Z

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.