From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzM6x-0001DF-77 for qemu-devel@nongnu.org; Fri, 12 Dec 2014 04:02:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzM6k-0004Ok-Rc for qemu-devel@nongnu.org; Fri, 12 Dec 2014 04:02:07 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:38120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzM6k-0004OU-Im for qemu-devel@nongnu.org; Fri, 12 Dec 2014 04:01:54 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Dec 2014 09:01:53 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CFA4C17D8043 for ; Fri, 12 Dec 2014 09:02:13 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBC91oiK63963256 for ; Fri, 12 Dec 2014 09:01:50 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBC91nE7003351 for ; Fri, 12 Dec 2014 02:01:50 -0700 From: Cornelia Huck Date: Fri, 12 Dec 2014 10:01:46 +0100 Message-Id: <1418374906-16358-2-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1418374906-16358-1-git-send-email-cornelia.huck@de.ibm.com> References: <1418374906-16358-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 1/1] virtio: fix feature bit checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Cornelia Huck , Thomas Huth , qemu-devel@nongnu.org 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; -- 1.8.5.5