diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-02-26 00:05:57 +0100 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2016-03-08 15:34:09 +0800 |
commit | 3a2d44f6dd1d6cc1e5a5ebfa736a72e035c41d1b (patch) | |
tree | e9336e9ba7a7b7080184cb4adeaaa5918b31cea4 /net | |
parent | d24b2b1cccbf598d004bc211a22af30e064dee65 (diff) | |
download | qemu-3a2d44f6dd1d6cc1e5a5ebfa736a72e035c41d1b.zip qemu-3a2d44f6dd1d6cc1e5a5ebfa736a72e035c41d1b.tar.gz qemu-3a2d44f6dd1d6cc1e5a5ebfa736a72e035c41d1b.tar.bz2 |
net: simplify net_init_tap_one logic
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 <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/tap.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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"); } } |