Received: from eggs.gnu.org ([2001:4830:134:3::10]:45677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ4yx-000315-7H for qemu-devel@nongnu.org; Thu, 25 Feb 2016 18:06:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ4yu-0005cO-2B for qemu-devel@nongnu.org; Thu, 25 Feb 2016 18:06:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ4yt-0005cK-T9 for qemu-devel@nongnu.org; Thu, 25 Feb 2016 18:05:59 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 739868F4F0 for ; Thu, 25 Feb 2016 23:05:59 +0000 (UTC) From: Paolo Bonzini Date: Fri, 26 Feb 2016 00:05:57 +0100 Message-Id: <1456441557-1096-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] net: simplify net_init_tap_one logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jasowang@redhat.com net_init_tap_one receives in vhostfdname a fd name from vhostfd= or vhostfds=, or NULL if there is no vhostfd=/vhostfds=. It is simpler to just check vhostfdname, than it is to check for vhostfd= or vhostfds=. This also calms down Coverity, which otherwise thinks that monitor_fd_param could dereference a NULL vhostfdname. Signed-off-by: Paolo Bonzini --- net/tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tap.c b/net/tap.c index cfb6831..cd7a7fc 100644 --- a/net/tap.c +++ b/net/tap.c @@ -662,7 +662,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; - if (tap->has_vhostfd || tap->has_vhostfds) { + if (vhostfdname) { vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err); if (vhostfd == -1) { error_propagate(errp, err); @@ -684,7 +684,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, "vhost-net requested but could not be initialized"); return; } - } else if (tap->has_vhostfd || tap->has_vhostfds) { + } else if (vhostfdname) { error_setg(errp, "vhostfd= is not valid without vhost"); } } -- 2.5.0