From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

virtio: fix the bug of reading queue msix vector

This patch fixes a silly bug caused by wrong placement of closing
parentheses which led to reading word value at offset 0x1 instead of
intended COMMON_CFG_OFFSET_OF(queue_msix_vector).

This bug did not cause real damage but made some hypervisors like
Intel's cloud hypervisor show this kind of warning:

cloud-hypervisor: 55.151472ms: <vcpu0> 
WARN:virtio-devices/src/transport/pci_common_config.rs:169 -- invalid virtio 
register word read: 0x1

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20211217033600.1407013-1-jwkozac...@gmail.com>

---
diff --git a/drivers/virtio-pci-device.cc b/drivers/virtio-pci-device.cc
--- a/drivers/virtio-pci-device.cc
+++ b/drivers/virtio-pci-device.cc
@@ -185,7 +185,7 @@ void virtio_modern_pci_device::setup_queue(vring *queue)
     if (_dev->is_msix()) {
         // Setup queue_id:entry_id 1:1 correlation...
         
_common_cfg->virtio_conf_writew(COMMON_CFG_OFFSET_OF(queue_msix_vector), 
queue_index);
-        if 
(_common_cfg->virtio_conf_readw(COMMON_CFG_OFFSET_OF(queue_msix_vector) != 
queue_index)) {
+        if 
(_common_cfg->virtio_conf_readw(COMMON_CFG_OFFSET_OF(queue_msix_vector)) != 
queue_index) {
             virtio_e("Setting MSIx entry for queue %d failed.", queue_index);
             return;
         }

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000091c65f05d38559d3%40google.com.

Reply via email to