linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>, Shaohua Li <shli@fb.com>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Ming Lei <ming.lei@redhat.com>,
	Vincent Fu <vincent.fu@samsung.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 2/2] null_blk: fix ida error handling in null_add_dev()
Date: Fri, 15 Jul 2022 12:14:41 +0300	[thread overview]
Message-ID: <20220715091441.GY2338@kadam> (raw)
In-Reply-To: <PH0PR04MB7416C95D473D2F35A8A1F5709B8B9@PH0PR04MB7416.namprd04.prod.outlook.com>

On Fri, Jul 15, 2022 at 08:23:24AM +0000, Johannes Thumshirn wrote:
> On 15.07.22 10:12, Dan Carpenter wrote:
> > -	nullb->index = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
> > -	dev->index = nullb->index;
> > +	rv = ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL);
> > +	if (rv < 0) {
> > +		mutex_unlock(&lock);
> > +		goto out_cleanup_zone;
> > +	}
> > +	nullb->index = rv;
> > +	dev->index = rv;
> 
> Isn't ida_simple_get() deprecated? And actually the 'max' argument is 0 here,
> so ida_alloc_range() tries to allocate a number between 0 and 0?

That was already there in the original code.  I was just fixing the bugs,
not doing cleanup.

The second zero means use INT_MAX.  (When a function has "simple" in
the name it is always intended ironically).

regards,
dan carpenter

  reply	other threads:[~2022-07-15  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15  8:10 [PATCH 1/2] null_blk: prevent NULL dereference in null_init_tag_set() Dan Carpenter
2022-07-15  8:12 ` [PATCH 2/2] null_blk: fix ida error handling in null_add_dev() Dan Carpenter
2022-07-15  8:23   ` Johannes Thumshirn
2022-07-15  9:14     ` Dan Carpenter [this message]
2022-07-15  9:26 ` [PATCH 1/2] null_blk: prevent NULL dereference in null_init_tag_set() Ming Lei
2022-07-15 15:05 ` (subset) " Jens Axboe

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=20220715091441.GY2338@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=kch@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=shli@fb.com \
    --cc=vincent.fu@samsung.com \
    /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;
as well as URLs for NNTP newsgroup(s).