Re: [PATCH 2/2] null_blk: fix ida error handling in null_add_dev()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux