[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT9gf0NkAuWWe02Q59HbjRB2WAJLJiRrrrFy5a46+po0eQ@mail.gmail.com>
Date: Fri, 10 Feb 2012 15:11:28 +0200
From: Alexey Dobriyan <adobriyan@...il.com>
To: Xi Wang <xi.wang@...il.com>
Cc: Jens Axboe <axboe@...nel.dk>, Pekka Enberg <penberg@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
linux-kernel@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
Matt Mackall <mpm@...enic.com>,
David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH RFC v2] slab: introduce kmalloc_array
On Fri, Feb 10, 2012 at 4:09 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
> On Thu, Feb 9, 2012 at 4:48 PM, Xi Wang <xi.wang@...il.com> wrote:
>> -static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
>> +static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
>> {
>> if (size != 0 && n > ULONG_MAX / size)
>> return NULL;
>> - return __kmalloc(n * size, flags | __GFP_ZERO);
>> + return __kmalloc(n * size, flags);
>> +}
>
> It should be named kaalloc(), I think.
> Why it is ULONG_MAX, when size_t is used?
Also, it could be written more "robust" against people who will make
sizeof() the first argument with __builtin_constant_p().
--
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