[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH RFCv4 35/35] plat/virtio: Fix the return value check for virtio_cread_bytes_many()
The return value of virtio_cread_bytes_many can be: 1) is -1 if something wrong 2) is len (>=0) if everything is fine So the check condition in vpci_legacy_pci_config_get should be adjusted if rc!=len Otherwise, the initialization of virtio-9p device will be failed on arm64 kvm plat. Signed-off-by: Jia He <justin.he@xxxxxxx> --- plat/drivers/virtio/virtio_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plat/drivers/virtio/virtio_pci.c b/plat/drivers/virtio/virtio_pci.c index 3c62a3c..3a2229a 100644 --- a/plat/drivers/virtio/virtio_pci.c +++ b/plat/drivers/virtio/virtio_pci.c @@ -278,8 +278,11 @@ static int vpci_legacy_pci_config_get(struct virtio_dev *vdev, __u16 offset, rc = virtio_cread_bytes_many( (void *) (unsigned long)vpdev->pci_base_addr, VIRTIO_PCI_CONFIG_OFF + offset, buf, len); + if (rc != (int)len) + return -EFAULT; } - return rc; + + return 0; } static __u8 vpci_legacy_pci_status_get(struct virtio_dev *vdev) -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |