mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>,
	<linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
	Jean Delvare <jdelvare@suse.de>,
	Monam Agarwal <monamagarwal123@gmail.com>,
	Jeff Layton <jlayton@redhat.com>,
	Andreas Gruenbacher <agruen@linbit.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCH 1/4] idr: proper invalid argument handling
Date: Tue, 22 Apr 2014 12:46:24 -0700	[thread overview]
Message-ID: <20140422124624.6297f6fddffd0110e2b12700@linux-foundation.org> (raw)
In-Reply-To: <20140422121656.14d5e5534ae4888119787471@linux-foundation.org>

On Tue, 22 Apr 2014 12:16:56 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:

> On Tue, 22 Apr 2014 18:16:18 +0800 Lai Jiangshan <laijs@cn.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.

  reply	other threads:[~2014-04-22 19:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 10:16 [PATCH 0/4] idr: idr cleanups Lai Jiangshan
2014-04-22 10:16 ` [PATCH 1/4] idr: proper invalid argument handling Lai Jiangshan
2014-04-22 19:16   ` Andrew Morton
2014-04-22 19:46     ` Andrew Morton [this message]
2014-04-22 19:54   ` Tejun Heo
2014-04-22 10:16 ` [PATCH 2/4] idr: reduce the number of MAX_IDR_FREE Lai Jiangshan
2014-04-22 19:58   ` Tejun Heo
2014-04-23  1:55     ` Lai Jiangshan
2014-04-22 10:16 ` [PATCH 3/4] ida: in-place ida allocation Lai Jiangshan
2014-04-22 20:02   ` Tejun Heo
2014-04-23  1:44     ` Lai Jiangshan
2014-04-22 10:16 ` [PATCH 4/4] idr: reorder the fields Lai Jiangshan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140422124624.6297f6fddffd0110e2b12700@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=agruen@linbit.com \
    --cc=jdelvare@suse.de \
    --cc=jlayton@redhat.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monamagarwal123@gmail.com \
    --cc=stephen@networkplumber.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®