kvm tools: Fix VHOST_SET_MEM_TABLE failure

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@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Asias He
2012-07-12 00:08:13 +08:00
committed by Will Deacon
parent 54cb8a31fc
commit 8b79545748
+1 -1
View File
@@ -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");