Received: from eggs.gnu.org ([2001:4830:134:3::10]:56893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDu4v-000300-NM for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:08:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDu4r-00063x-W6 for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:08:09 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:51801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDu4r-00063X-OK for qemu-devel@nongnu.org; Wed, 21 Jan 2015 07:08:05 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Jan 2015 12:08:04 -0000 Date: Wed, 21 Jan 2015 13:07:59 +0100 From: Thomas Huth Message-ID: <20150121130759.51dcb756@oc7435384737.ibm.com> In-Reply-To: <1418374906-16358-2-git-send-email-cornelia.huck@de.ibm.com> References: <1418374906-16358-1-git-send-email-cornelia.huck@de.ibm.com> <1418374906-16358-2-git-send-email-cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: qemu-stable@nongnu.org, qemu-devel@nongnu.org, "Michael S. Tsirkin" On Fri, 12 Dec 2014 10:01:46 +0100 Cornelia Huck wrote: > Several places check against the feature bit number instead of against > the feature bit. Fix them. > > Reported-by: Thomas Huth > Signed-off-by: Cornelia Huck > --- > hw/scsi/virtio-scsi.c | 2 +- > hw/virtio/dataplane/vring.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c > index ef48550..a44c410 100644 > --- a/hw/scsi/virtio-scsi.c > +++ b/hw/scsi/virtio-scsi.c > @@ -144,7 +144,7 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req, > * > * TODO: always disable this workaround for virtio 1.0 devices. > */ > - if ((vdev->guest_features & VIRTIO_F_ANY_LAYOUT) == 0) { > + if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) { > req_size = req->elem.out_sg[0].iov_len; > resp_size = req->elem.in_sg[0].iov_len; > } > diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c > index 61f6d83..78c6f45 100644 > --- a/hw/virtio/dataplane/vring.c > +++ b/hw/virtio/dataplane/vring.c > @@ -133,12 +133,12 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring) > * interrupts. */ > smp_mb(); > > - if ((vdev->guest_features & VIRTIO_F_NOTIFY_ON_EMPTY) && > + if ((vdev->guest_features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) && > unlikely(vring->vr.avail->idx == vring->last_avail_idx)) { > return true; > } > > - if (!(vdev->guest_features & VIRTIO_RING_F_EVENT_IDX)) { > + if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) { > return !(vring->vr.avail->flags & VRING_AVAIL_F_NO_INTERRUPT); > } > old = vring->signalled_used; Ping ... somebody taking care of this? It's a bug fix for current code, so IMHO this patch should not wait for the inclusion of the other virtio-1 stuff... Thomas