diff mbox series

hw/pvrdma: Some cosmetic fixes

Message ID 20220403095837.2378-1-yuval.shaia.ml@gmail.com (mailing list archive)
State New, archived
Headers show
Series hw/pvrdma: Some cosmetic fixes | expand

Commit Message

Yuval Shaia April 3, 2022, 9:58 a.m. UTC
Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
---
 hw/rdma/vmw/pvrdma_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Marcel Apfelbaum April 5, 2022, 10:25 a.m. UTC | #1
On Sun, Apr 3, 2022 at 12:00 PM Yuval Shaia <yuval.shaia.ml@gmail.com> wrote:
>
> Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
> ---
>  hw/rdma/vmw/pvrdma_main.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
> index 91206dbb8e..aae382af59 100644
> --- a/hw/rdma/vmw/pvrdma_main.c
> +++ b/hw/rdma/vmw/pvrdma_main.c
> @@ -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;
>      }
> --
> 2.20.1
>

cc: QEMU Trivial <qemu-trivial@nongnu.org>

Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Thanks,
Marcel
Laurent Vivier April 26, 2022, 10:26 a.m. UTC | #2
Le 05/04/2022 à 12:25, Marcel Apfelbaum a écrit :
> On Sun, Apr 3, 2022 at 12:00 PM Yuval Shaia <yuval.shaia.ml@gmail.com> wrote:
>>
>> Signed-off-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
>> ---
>>   hw/rdma/vmw/pvrdma_main.c | 9 +++++----
>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
>> index 91206dbb8e..aae382af59 100644
>> --- a/hw/rdma/vmw/pvrdma_main.c
>> +++ b/hw/rdma/vmw/pvrdma_main.c
>> @@ -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;
>>       }
>> --
>> 2.20.1
>>
> 
> cc: QEMU Trivial <qemu-trivial@nongnu.org>
> 
> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>


Applied to my trivial-patches branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
index 91206dbb8e..aae382af59 100644
--- a/hw/rdma/vmw/pvrdma_main.c
+++ b/hw/rdma/vmw/pvrdma_main.c
@@ -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;
     }