Re: [RFC][PATCH] mm: Remove ZERO_SIZE_PTR.

From: KOSAKI Motohiro
Date: Fri Feb 26 2010 - 03:45:18 EST


> KOSAKI Motohiro wrote:
> > > Therefore, at the cost of being unable to distinguish "NULL pointer
> > > dereference" and "ZERO_SIZE_PTR dereference" in some cases, removing
> > > ZERO_SIZE_PTR could reduce the risk of "ZERO_SIZE_PTR dereference" in many
> > > cases.
> >
> > NAK. yes, it could. but it is no worth. nobody want slower kernel.
> >
> This patch simplifies error checks of both callers/callees from
>
> ((unsigned long)(x) <= (unsigned long) 16)
>
> to
>
> !(x)
>
> . Why this patch makes the kernel slower?

You misunderstand your patch's effect. you try to change kmalloc
semantics. currently kmalloc(0) is valid and allowed. but you want
to change invalid. then, we need additional check into the caller of
using kmalloc(0). there is in real world.

IOW, your patch is broken and introduce incompatibility.


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