From patchwork Wed Jul 11 11:45:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 1181841 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 0423CDF25A for ; Wed, 11 Jul 2012 11:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757299Ab2GKLnw (ORCPT ); Wed, 11 Jul 2012 07:43:52 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:51703 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754371Ab2GKLnw (ORCPT ); Wed, 11 Jul 2012 07:43:52 -0400 Received: by gglu4 with SMTP id u4so1084835ggl.19 for ; Wed, 11 Jul 2012 04:43:51 -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=uPosx97940KHsiDJbM9p9sSBzS5a1+Fe9VH9SbUPn5lNz5PBtO2ICKxW/nAtF7l9x3 s8Pis7u9HHhwa1aey4kvkSlb5lQdARcW9Jo195HPr0edZCALJqo/8STxkFQvcqlHLsm4 /9old4Jk9XARR1W111/MrB9mg5usYLqdQbH2G+hTzvjK7OClkpklf8EaGhuNDnHlYPLH s4berDmuvxEZO68QU84yvJFKSKONBQfAwi3bQ2Xl7o9NnX5vmd/tjo5cFz13ktFS9n+l oTbubM8Cg+gjzVggn+8QdwjobDcRr9eMqsfP5BICpg1dsGtXiWU7vRJ6oNXQiEOs9yal d+Ag== Received: by 10.66.87.2 with SMTP id t2mr51119115paz.22.1342007031165; Wed, 11 Jul 2012 04:43:51 -0700 (PDT) Received: from hj.localdomain.com ([58.194.229.69]) by mx.google.com with ESMTPS id ns5sm1577213pbb.26.2012.07.11.04.43.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 04:43:50 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org, Asias He Subject: [PATCH 1/2] kvm tools: Fix VHOST_SET_MEM_TABLE failure Date: Wed, 11 Jul 2012 19:45:29 +0800 Message-Id: <1342007130-23114-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");