Re: Uninline kcalloc

From: Christoph Lameter
Date: Wed Feb 15 2012 - 14:34:13 EST


On Wed, 15 Feb 2012, Xi Wang wrote:

> for overflow, one has to write:
>
> size_t s = calculate_array_size(n, size);
> if (s)
> p = kmalloc(s, ...);
>
> This "if" thing is just too verbose --- you need three lines to
> allocate an array.
>
> We could change calculate_array_size() to return ULONG_MAX or some
> large number with which kmalloc() would fail. Then one would write:

Any allocation larger than MAX_ORDER << PAGE_SHIFT will fail since the
page allocator cannot serve larger contigous pages.


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