Skip to contentSkip to conversation

hw/pvrdma: Some cosmetic fixes

PATCH Applied Yuval Shaia 3 participants 3 messages Apr 3, 2022 – Apr 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pvrdma: Some cosmetic fixes

---
 hw/rdma/vmw/pvrdma_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
hw/rdma/vmw/pvrdma_main.c +5 -4
index 91206dbb8e..aae382af59 100644
@@ -159,13 +159,13 @@ static void free_dsr(PVRDMADev *dev)
     free_dev_ring(pci_dev, &dev->dsr_info.cq, dev->dsr_info.cq_ring_state);
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.req,
-                         sizeof(union pvrdma_cmd_req));
+                       sizeof(union pvrdma_cmd_req));
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.rsp,
-                         sizeof(union pvrdma_cmd_resp));
+                       sizeof(union pvrdma_cmd_resp));
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.dsr,
-                         sizeof(struct pvrdma_device_shared_region));
+                       sizeof(struct pvrdma_device_shared_region));
 
     dev->dsr_info.dsr = NULL;
 }
@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev *dev)
 {
     struct pvrdma_device_shared_region *dsr;
 
-    if (dev->dsr_info.dsr == NULL) {
+    if (!dev->dsr_info.dsr) {
+        /* Buggy or malicious guest driver */
         rdma_error_report("Can't initialized DSR");
         return;
     }
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Yuval Shaia
---
 hw/rdma/vmw/pvrdma_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
hw/rdma/vmw/pvrdma_main.c +5 -5
index 91206dbb8e..aae382af59 100644
@@ -159,13 +159,13 @@ static void free_dsr(PVRDMADev *dev)
     free_dev_ring(pci_dev, &dev->dsr_info.cq, dev->dsr_info.cq_ring_state);
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.req,
-                         sizeof(union pvrdma_cmd_req));
+                       sizeof(union pvrdma_cmd_req));
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.rsp,
-                         sizeof(union pvrdma_cmd_resp));
+                       sizeof(union pvrdma_cmd_resp));
 
     rdma_pci_dma_unmap(pci_dev, dev->dsr_info.dsr,
-                         sizeof(struct pvrdma_device_shared_region));
+                       sizeof(struct pvrdma_device_shared_region));
 
     dev->dsr_info.dsr = NULL;
 }
@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev *dev)
 {
     struct pvrdma_device_shared_region *dsr;
 
-    if (dev->dsr_info.dsr == NULL) {
+    if (!dev->dsr_info.dsr) {
+        /* Buggy or malicious guest driver */
         rdma_error_report("Can't initialized DSR");
         return;
     }
--
Quoted 2 lines

2.20.1

cc QEMU Trivial <[email protected]>

Thanks,
Marcel

#2 lore raw

Le 05/04/2022 à 12:25, Marcel Apfelbaum a écrit :

Quoted 44 lines · Yuval Shaia
Quoted 38 lines
---
  hw/rdma/vmw/pvrdma_main.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
hw/rdma/vmw/pvrdma_main.c +5 -5
index 91206dbb8e..aae382af59 100644
@@ -159,13 +159,13 @@ static void free_dsr(PVRDMADev *dev)
      free_dev_ring(pci_dev, &dev->dsr_info.cq, dev->dsr_info.cq_ring_state);
 
      rdma_pci_dma_unmap(pci_dev, dev->dsr_info.req,
-                         sizeof(union pvrdma_cmd_req));
+                       sizeof(union pvrdma_cmd_req));
 
      rdma_pci_dma_unmap(pci_dev, dev->dsr_info.rsp,
-                         sizeof(union pvrdma_cmd_resp));
+                       sizeof(union pvrdma_cmd_resp));
 
      rdma_pci_dma_unmap(pci_dev, dev->dsr_info.dsr,
-                         sizeof(struct pvrdma_device_shared_region));
+                       sizeof(struct pvrdma_device_shared_region));
 
      dev->dsr_info.dsr = NULL;
  }
@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev *dev)
  {
      struct pvrdma_device_shared_region *dsr;
 
-    if (dev->dsr_info.dsr == NULL) {
+    if (!dev->dsr_info.dsr) {
+        /* Buggy or malicious guest driver */
          rdma_error_report("Can't initialized DSR");
          return;
      }
--
Quoted 2 lines

2.20.1

cc QEMU Trivial <[email protected]>
Quoted 1 line

Applied to my trivial-patches branch.

Thanks,
Laurent