virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: keliu <liuke94@huawei.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	virtualization@lists.linux-foundation.org,
	linux-block@vger.kernel.org, stefanha@redhat.com,
	pbonzini@redhat.com
Subject: Re: [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX()
Date: Fri, 27 May 2022 06:19:22 -0400	[thread overview]
Message-ID: <20220527061845-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <fa54e172-ef9d-fba5-ad37-72a6698c7cb8@wanadoo.fr>

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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

       reply	other threads:[~2022-05-27 10:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa54e172-ef9d-fba5-ad37-72a6698c7cb8@wanadoo.fr>
2022-05-27 10:19 ` Michael S. Tsirkin [this message]
     [not found] <20220420041053.7927-1-kch@nvidia.com>
     [not found] ` <20220420041053.7927-5-kch@nvidia.com>
2022-04-20 15:19   ` [PATCH 4/4] virtio-blk: remove deprecated ida_simple_XXX() Stefan Hajnoczi

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=20220527061845-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuke94@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).