Re: [PATCH RFC v2] slab: introduce kmalloc_array

From: Alexey Dobriyan
Date: Fri Feb 10 2012 - 08:09:18 EST


On Thu, Feb 9, 2012 at 4:48 PM, Xi Wang <xi.wang@xxxxxxxxx> 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?
--
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/