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

From: David Wagner
Date: Fri Feb 26 2010 - 13:23:15 EST


Tetsuo Handa wrote:
>This patch simplifies error checks of both callers/callees from
>
> ((unsigned long)(x) <= (unsigned long) 16)
>
>to
>
> !(x)

I don't follow. If you want to avoid integer overflow, the caller
of kmalloc() must check to make sure that the arithmetic operations
it performs do not overflow. That's true whether or not your patch
is accepted. An integer overflow in an arithmetic operation can yield
a non-zero value, so checking "!(x)" does not guarantee that there was
no integer overflow involved in the computation of x.
--
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/