Skip to contentSkip to conversation

vpci bugfixes

PATCH In review Roger Pau Monne 1 participant 5 messages Mar 26, 2018

lore
Share & tools
lore
#0 lore raw

cover vpci bugfixes

Hello,

This tree patches are bugfixes for the vPCI code merged last week. They where spotted by Coverity.

Thanks, Roger.

Roger Pau Monne (3):
vpci/bars: fix error message
vpci/msix: fix incorrect usage of bitmask
vpci/msi: fix size of the vectors fields

 xen/drivers/vpci/header.c | 2 +-
 xen/drivers/vpci/msix.c   | 2 +-
 xen/include/xen/vpci.h    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 7 lines
2.16.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/3 vpci/bars: fix error message

Error message is incorrectly using map when it should be using map->map instead.

Reported-by Coverity
---
 xen/drivers/vpci/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/vpci/header.c +1 -1
index 91a71ca66e..0ec4c082a6 100644
@@ -63,7 +63,7 @@ static int map_range(unsigned long s, unsigned long e, void *data,
         {
             printk(XENLOG_G_WARNING
                    "Failed to identity %smap [%lx, %lx] for d%d: %d\n",
-                   map ? "" : "un", s, e, map->d->domain_id, rc);
+                   map->map ? "" : "un", s, e, map->d->domain_id, rc);
             break;
         }
         ASSERT(rc < size);
Signature · 7 lines
2.16.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH 2/3 vpci/msix: fix incorrect usage of bitmask

In reply to Roger Pau Monne

The bitmask to clear the low bits of the address field should be ~0xffffffffull, the current mask clears both the low and the high bits of the address field, which is a bug.

Reported-by Coverity
---
 xen/drivers/vpci/msix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/vpci/msix.c +1 -1
index 3b378c2e51..bcf63256f6 100644
@@ -328,7 +328,7 @@ static int msix_write(struct vcpu *v, unsigned long addr, unsigned int len,
             entry->addr = data;
             break;
         }
-        entry->addr &= ~0xffffffff;
+        entry->addr &= ~0xffffffffull;
         entry->addr |= data;
         break;
 
Signature · 7 lines
2.16.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

PATCH 3/3 vpci/msi: fix size of the vectors fields

In reply to Roger Pau Monne

The current size (5bits) is not enough to store the maximum number of vectors (32), bump it by one bit.

Note that the size of the struct is still the same.

Reported-by Coverity
---
 xen/include/xen/vpci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/include/xen/vpci.h +2 -2
index cb39e0ebea..fac12a1c42 100644
@@ -100,7 +100,7 @@ struct vpci {
         /* Data. */
         uint16_t data;
         /* Maximum number of vectors supported by the device. */
-        uint8_t max_vectors : 5;
+        uint8_t max_vectors : 6;
         /* Enabled? */
         bool enabled        : 1;
         /* Supports per-vector masking? */
@@ -108,7 +108,7 @@ struct vpci {
         /* 64-bit address capable? */
         bool address64      : 1;
         /* Number of vectors configured. */
-        uint8_t vectors     : 5;
+        uint8_t vectors     : 6;
         /* Arch-specific data. */
         struct vpci_arch_msi arch;
     } *msi;
Signature · 7 lines
2.16.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel