From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: [PATCH] virtio: fix wrong features returned for legacy virtio Date: Thu, 10 Mar 2016 15:01:20 +0800 Message-ID: <1457593280-25412-1-git-send-email-yuanhan.liu@linux.intel.com> To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 408E62BA2 for ; Thu, 10 Mar 2016 07:58:40 +0100 (CET) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Declare dst as type uint32_t instead of uint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that include VIRTIO_F_VERSION_1 (the 32th bit) for legacy virtio, which is obviously wrong. Fixes: b8f04520ad71 ("virtio: use PCI ioport API") Cc: David Marchand Signed-off-by: Yuanhan Liu --- drivers/net/virtio/virtio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index 98fc370..c007959 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset, static uint64_t legacy_get_features(struct virtio_hw *hw) { - uint64_t dst; + uint32_t dst; rte_eal_pci_ioport_read(&hw->io, &dst, 4, VIRTIO_PCI_HOST_FEATURES); return dst; -- 1.9.0