[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140422124624.6297f6fddffd0110e2b12700@linux-foundation.org>
Date: Tue, 22 Apr 2014 12:46:24 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Lai Jiangshan <laijs@...fujitsu.com>,
<linux-kernel@...r.kernel.org>, Tejun Heo <tj@...nel.org>,
Jean Delvare <jdelvare@...e.de>,
Monam Agarwal <monamagarwal123@...il.com>,
Jeff Layton <jlayton@...hat.com>,
Andreas Gruenbacher <agruen@...bit.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH 1/4] idr: proper invalid argument handling
On Tue, 22 Apr 2014 12:16:56 -0700 Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Tue, 22 Apr 2014 18:16:18 +0800 Lai Jiangshan <laijs@...fujitsu.com> wrote:
>
> > When the arguments passed by the caller are invalid, WARN_ON_ONCE()
> > is proper than BUG_ON() which may crash the kernel.
> >
> > ida_remove()/idr_remove() add checks for "id < 0".
> > BUG_ON() in ida_simple_remove() is simply removed, due to
> > ida_remove() already checks for "id < 0".
> >
> > In idr_alloc(), it still returns -ENOSPC when "start == end",
> > but it returns -EINVAL when "max < start" while old code returns
> > -ENOSPC. -EINVAL is proper here, the caller must passed wrong
> > arguments.
> >
> > ida_simple_get()'s argument-checks are changed as the same as
> > idr_alloc().
>
> This patch doesn't apply.
>
> > @@ -551,10 +553,7 @@ void idr_remove(struct idr *idp, int id)
> > struct idr_layer *p;
> > struct idr_layer *to_free;
> >
> > - if (id < 0)
> > - return;
> > -
> > - if (id > idr_max(idp->layers)) {
> > + if (id < 0 || id > idr_max(idp->layers)) {
> > idr_remove_warning(id);
> > return;
> > }
>
> 3.15-rc2's idr_remove() has a call to sub_remove() in there, but
> whatever-kernel-you're-using does not.
Ah, it's based on your other idr patchset. That's what I get for
working in reverse time order.
--
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