From patchwork Mon Jul 20 09:28:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 6825971 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E79AFC05AC for ; Mon, 20 Jul 2015 09:30:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24A6D2064E for ; Mon, 20 Jul 2015 09:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E6032063A for ; Mon, 20 Jul 2015 09:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752644AbbGTJaI (ORCPT ); Mon, 20 Jul 2015 05:30:08 -0400 Received: from mga14.intel.com ([192.55.52.115]:8488 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752386AbbGTJaH (ORCPT ); Mon, 20 Jul 2015 05:30:07 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 20 Jul 2015 02:30:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,507,1432623600"; d="scan'208";a="750647626" Received: from dufan-optiplex-9010.bj.intel.com ([10.238.155.102]) by fmsmga001.fm.intel.com with ESMTP; 20 Jul 2015 02:30:07 -0700 From: Fan Du To: kvm@vger.kernel.org Cc: penberg@kernel.org, Fan Du Subject: [PATCH 2/3] kvm-tool: Pass address of pointer to ioctl for tap Date: Mon, 20 Jul 2015 17:28:46 +0800 Message-Id: <1437384527-22987-3-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1437384527-22987-1-git-send-email-fan.du@intel.com> References: <1437384527-22987-1-git-send-email-fan.du@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When enable virtio tap mode as root previliege by: lkvm run --disk linux-0.2.img --kernel bzImage --network virtio lkvm spits: [ 1.981352] loop: module loaded [ 1.986039] vda: Warning: Config tap device error. Are you root? You have requested a TAP device, but creation of one has failed because: Invalid argument The last param of ioctl should be a pointer address Signed-off-by: Fan Du Fixes: e325f3e77e78 ("kvmtool: Add minimal support for macvtap") --- 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 f3f7200..5678ff2 100644 --- a/tools/kvm/virtio/net.c +++ b/tools/kvm/virtio/net.c @@ -286,7 +286,7 @@ static int virtio_net_request_tap(struct net_dev *ndev, struct ifreq *ifr, if (tapname) strncpy(ifr->ifr_name, tapname, sizeof(ifr->ifr_name)); - ret = ioctl(ndev->tap_fd, TUNSETIFF, &ifr); + ret = ioctl(ndev->tap_fd, TUNSETIFF, ifr); if (ret >= 0) strncpy(ndev->tap_name, ifr->ifr_name, sizeof(ndev->tap_name));