open_int() stores through a uint16_t pointer, but seven of its eight
callers pass the address of an int. Only two bytes of a four byte
object are written. It happens to work on little endian because each
caller initializes its variable to zero first, but it is still a store
of the wrong width, and on big endian it would set the high half.

Give those seven locals the uint16_t width that the handler actually
writes. They are only ever tested against 0 and 1.

Fixes: 39cac2adcad0 ("net/vhost: add client option")
Cc: [email protected]

Signed-off-by: Stephen Hemminger <[email protected]>
---
 drivers/net/vhost/rte_eth_vhost.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 41b77d8533..e4e90e7a5c 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1668,13 +1668,13 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
        uint16_t queues;
        uint64_t flags = RTE_VHOST_USER_NET_STATS_ENABLE;
        uint64_t disable_flags = 0;
-       int client_mode = 0;
-       int iommu_support = 0;
-       int postcopy_support = 0;
-       int tso = 0;
-       int linear_buf = 0;
-       int ext_buf = 0;
-       int legacy_ol_flags = 0;
+       uint16_t client_mode = 0;
+       uint16_t iommu_support = 0;
+       uint16_t postcopy_support = 0;
+       uint16_t tso = 0;
+       uint16_t linear_buf = 0;
+       uint16_t ext_buf = 0;
+       uint16_t legacy_ol_flags = 0;
        struct rte_eth_dev *eth_dev;
        const char *name = rte_vdev_device_name(dev);
 
-- 
2.53.0

Reply via email to