[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/14] net: simplify net_init_tap_one logic
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PULL 04/14] net: simplify net_init_tap_one logic |
Date: |
Mon, 7 Mar 2016 11:12:50 +0800 |
From: Paolo Bonzini <address@hidden>
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 <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
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
- [Qemu-devel] [PULL 00/14] Net patches, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 01/14] net: ne2000: check ring buffer control registers, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 02/14] net: filter: correctly remove filter from the list during finalization, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 03/14] MAINTAINERS: Add entries for include/net/ files, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 04/14] net: simplify net_init_tap_one logic,
Jason Wang <=
- [Qemu-devel] [PULL 05/14] net/filter-mirror:Add filter-mirror, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 06/14] tests/test-filter-mirror:add filter-mirror unit test, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 07/14] net: netmap: probe netmap interface for virtio-net header, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 08/14] rocker: forbid to change world type, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 09/14] rocker: return -ENOMEM in case of some world alloc fails, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 10/14] rocker: add name field into WorldOps ale let world specify its name, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 11/14] rocker: allow user to specify rocker world by property, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 12/14] filter: Add 'status' property for filter object, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 13/14] filter-buffer: Add status_changed callback processing, Jason Wang, 2016/03/06
- [Qemu-devel] [PULL 14/14] net: check packet payload length, Jason Wang, 2016/03/06