[PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure

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

 



VHOST_SET_MEM_TABLE failed: Operation not supported

In vhost_set_memory(), We have

        if (mem.padding)
                return -EOPNOTSUPP;

So, we need to zero struct vhost_memory.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 tools/kvm/virtio/net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index ae17eb5..aa769d9 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -471,7 +471,7 @@ static void virtio_net__vhost_init(struct kvm *kvm, struct net_dev *ndev)
 	if (ndev->vhost_fd < 0)
 		die_perror("Failed openning vhost-net device");
 
-	mem = malloc(sizeof(*mem) + sizeof(struct vhost_memory_region));
+	mem = calloc(1, sizeof(*mem) + sizeof(struct vhost_memory_region));
 	if (mem == NULL)
 		die("Failed allocating memory for vhost memory map");
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux