All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
To: kvm@vger.kernel.org
Cc: Andre Przywara <andre.przywara@arm.com>,
	Will Deacon <will@kernel.org>,
	Alexandru Elisei <Alexandru.Elisei@arm.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.org>
Subject: [PATCH kvmtool v2] virtio-net: Fix vq->use_event_idx flag check
Date: Thu, 29 Sep 2022 14:18:58 +0200	[thread overview]
Message-ID: <20220929121858.156-1-dinhngoc.tu@irit.fr> (raw)
In-Reply-To: <20220929122136.38f74d7f@donnerap.cambridge.arm.com>

VIRTIO_RING_F_EVENT_IDX is a bit position value, but
virtio_init_device_vq populates vq->use_event_idx by ANDing this value
directly to vdev->features.

Fix the check for this flag in virtio_init_device_vq.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
---
 virtio/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virtio/core.c b/virtio/core.c
index f432421..ea0e5b6 100644
--- a/virtio/core.c
+++ b/virtio/core.c
@@ -165,7 +165,7 @@ void virtio_init_device_vq(struct kvm *kvm, struct virtio_device *vdev,
 	struct vring_addr *addr = &vq->vring_addr;
 
 	vq->endian		= vdev->endian;
-	vq->use_event_idx	= (vdev->features & VIRTIO_RING_F_EVENT_IDX);
+	vq->use_event_idx	= (vdev->features & (1UL << VIRTIO_RING_F_EVENT_IDX));
 	vq->enabled		= true;
 
 	if (addr->legacy) {
-- 
2.25.1


  reply	other threads:[~2022-09-29 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 15:16 [PATCH kvmtool] virtio-net: Fix vq->use_event_idx flag check dinhngoc.tu
2022-09-29 10:01 ` Andre Przywara
2022-09-29 10:14 ` [PATCH kvmtool v2] " Tu Dinh Ngoc
2022-09-29 11:21   ` Andre Przywara
2022-09-29 12:18     ` Tu Dinh Ngoc [this message]
2022-10-04 11:54       ` Will Deacon

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=20220929121858.156-1-dinhngoc.tu@irit.fr \
    --to=dinhngoc.tu@irit.fr \
    --cc=Alexandru.Elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=jean-philippe@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.