[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 for-4.11 1/2] vpci/msi: fix size of the vectors fields



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

Also change the layout so that 'vectors' is aligned to a 8bit
boundary.

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

Reported-by: Coverity
Coverity ID: 1430810
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Changes since v1:
 - Move the position of the 'enabled' field in the msi struct.
---
 xen/include/xen/vpci.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index cb39e0ebea..29616624ad 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -100,15 +100,15 @@ struct vpci {
         /* Data. */
         uint16_t data;
         /* Maximum number of vectors supported by the device. */
-        uint8_t max_vectors : 5;
-        /* Enabled? */
-        bool enabled        : 1;
+        uint8_t max_vectors : 6;
         /* Supports per-vector masking? */
         bool masking        : 1;
         /* 64-bit address capable? */
         bool address64      : 1;
         /* Number of vectors configured. */
-        uint8_t vectors     : 5;
+        uint8_t vectors     : 6;
+        /* Enabled? */
+        bool enabled        : 1;
         /* Arch-specific data. */
         struct vpci_arch_msi arch;
     } *msi;
-- 
2.16.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.