All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure
@ 2012-07-11 16:08 Asias He
  2012-07-11 16:08 ` [PATCH v2 2/2] kvm tools: Do not poll ioeventfd if vhost is enabled Asias He
  2012-07-11 16:09 ` [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Avi Kivity
  0 siblings, 2 replies; 6+ messages in thread
From: Asias He @ 2012-07-11 16:08 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Ingo Molnar, Cyrill Gorcunov, kvm, Asias He

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>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-12 23:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 16:08 [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Asias He
2012-07-11 16:08 ` [PATCH v2 2/2] kvm tools: Do not poll ioeventfd if vhost is enabled Asias He
2012-07-11 16:09 ` [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Avi Kivity
2012-07-12  2:46   ` Asias He
2012-07-12  8:19     ` Avi Kivity
2012-07-12 23:27       ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.