lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220527061845-mutt-send-email-mst@kernel.org>
Date:   Fri, 27 May 2022 06:19:22 -0400
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     kch@...dia.com, jasowang@...hat.com, linux-block@...r.kernel.org,
        pbonzini@...hat.com, stefanha@...hat.com,
        virtualization@...ts.linux-foundation.org,
        keliu <liuke94@...wei.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()

On Fri, May 27, 2022 at 10:04:46AM +0200, Christophe JAILLET wrote:
> (Resend, my email client sent it as HTML. So sorry for the duplicate)
> 
> 
> Hi,
> 
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 74c3a48cd1e5..e05748337dd1 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> > @@ -720,8 +720,8 @@ static int virtblk_probe(struct virtio_device *vdev)
> > 		return -EINVAL;
> > 	}
> >
> >-	err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
> >-			     GFP_KERNEL);
> >+	err = ida_alloc_max(&vd_index_ida, minor_to_index(1 << MINORBITS),
> >+			    GFP_KERNEL);
> > 	if (err < 0)
> > 		goto out;
> > 	index = err;
> 
> 
> this patch, already applied to -next, is wrong.
> 
> 
> The upper bound of ida_simple_get() is exlcusive, while the one of
> ida_alloc_max() is inclusive.
> 
> So, 'minor_to_index(1 << MINORBITS)' should be 'minor_to_index(1 <<
> MINORBITS) - 1' here.
> 
> 
> (adding keliu in cc: because he is proposing the same kind of patches, so he
> will see how to to these changes that are slighly tricky)
> 
> 
> CJ

I will drop this for now, please resend with either
a corrected version or a comment explaining why it's correct.

Thanks!

-- 
MST

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ