Re: [PATCH RESEND 3/3] percpu_ida: Sanity check initialization parameters

From: Kent Overstreet
Date: Wed Feb 26 2014 - 18:07:28 EST


On Thu, Feb 06, 2014 at 01:24:55PM +0100, Alexander Gordeev wrote:
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> Cc: Kent Overstreet <kmo@xxxxxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: "Nicholas A. Bellinger" <nab@xxxxxxxxxxxxxxx>
> ---
> lib/percpu_ida.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
> index c2fa3dc..81b5ae9 100644
> --- a/lib/percpu_ida.c
> +++ b/lib/percpu_ida.c
> @@ -305,6 +305,11 @@ int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,
> {
> unsigned i, cpu, order;
>
> + if (batch_size > max_size)
> + return -ERANGE;
> + if (!batch_size)
> + return -EINVAL;
> +
> memset(pool, 0, sizeof(*pool));
>
> init_waitqueue_head(&pool->wait);

Acked-by: Kent Overstreet <koverstreet@xxxxxxxxxxxxx>
--
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/