From patchwork Wed Jul 11 16:08:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 1183881 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 61C5ADF25A for ; Wed, 11 Jul 2012 16:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756194Ab2GKQGo (ORCPT ); Wed, 11 Jul 2012 12:06:44 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:64753 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755573Ab2GKQGn (ORCPT ); Wed, 11 Jul 2012 12:06:43 -0400 Received: by pbbrp8 with SMTP id rp8so2200678pbb.19 for ; Wed, 11 Jul 2012 09:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=405llSD8qalCElYpM8b9diFA4CmqLG3xkmeBWbRg7ZA=; b=kyWSMhwqDzQgJfvxRjiKiBcD0GQ0NqFsxseoIzMpiWoqbWjOmvBxEVw6jFHfJpDUiW r+EJh/Ajww9/XZJ2W+fmTnh/iWlBXQLQvk64lbpp0TsIbKPTb4iXS4JZAvMv4Ke/eBrK nUEhP4JOVhsVJFcQxIMXSDJn6PXZsbT3G0rvXB4AGoBLDJ2p3XeBbG0i87Z2a0kSXu19 iXDZhHQhY7ujVb3U6qXRMG0riIk+RQjBUNL295xm9+/aTOy+S4KHNEvehbrc/HQn7+gm 53ISSpumhcfTLRHuCoy9Yt+nC98aoGEbQfy29B66VbGQXKz1zCbhlwPIt0Vtl7bBMHBN k+Cw== Received: by 10.68.190.168 with SMTP id gr8mr4838797pbc.157.1342022802524; Wed, 11 Jul 2012 09:06:42 -0700 (PDT) Received: from localhost.localdomain ([58.194.229.69]) by mx.google.com with ESMTPS id pq5sm1957086pbb.30.2012.07.11.09.06.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 09:06:41 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org, Asias He Subject: [PATCH v2 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Date: Thu, 12 Jul 2012 00:08:13 +0800 Message-Id: <1342022894-1034-1-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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");