[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1202151324060.28225@router.home>
Date: Wed, 15 Feb 2012 13:34:11 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Xi Wang <xi.wang@...il.com>
cc: Pekka Enberg <penberg@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
Jesper Juhl <jj@...osbits.net>, Jens Axboe <axboe@...nel.dk>,
linux-kernel@...r.kernel.org, Matt Mackall <mpm@...enic.com>,
David Rientjes <rientjes@...gle.com>
Subject: Re: Uninline kcalloc
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists