Re: [PATCH RFC v2] slab: introduce kmalloc_array

From: Andrew Morton
Date: Thu Feb 09 2012 - 18:08:55 EST


On Thu, 9 Feb 2012 14:42:49 -0800 (PST)
David Rientjes <rientjes@xxxxxxxxxx> wrote:

> On Thu, 9 Feb 2012, Xi Wang wrote:
>
> > This patch introduces a kmalloc_array() wrapper that performs integer
> > overflow checking without zeroing the memory.
> >
> > Suggested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Suggested-by: Jens Axboe <axboe@xxxxxxxxx>
> > Signed-off-by: Xi Wang <xi.wang@xxxxxxxxx>
>
> Acked-by: David Rientjes <rientjes@xxxxxxxxxx>
>
> assuming there's at least one new user or one existing user that can be
> modified to use the new interface and this won't just sit around not being
> used.

The need is there - I've whined about the absence of kmalloc_array()
maybe 3 times in the past year.

Often kcalloc() is suitable - quite a lot of arrays which are sized
based on a userspace-provided dimension are also zeroed out. For some
reason.

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