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 <[email protected]>
---
 drivers/virtio-pci-device.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio-pci-device.cc b/drivers/virtio-pci-device.cc
index 297758fc..d5b1da9c 100644
--- 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;
         }
-- 
2.31.1

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20211217033600.1407013-1-jwkozaczuk%40gmail.com.

Reply via email to