--- usr.sbin/bhyve/pci_virtio_console.c.orig +++ usr.sbin/bhyve/pci_virtio_console.c @@ -404,6 +404,7 @@ do { n = vq_getchain(vq, &idx, &iov, 1, NULL); + assert(n == 1); len = readv(sock->vss_conn_fd, &iov, n); if (len == 0 || (len < 0 && errno == EWOULDBLOCK)) { @@ -544,7 +545,6 @@ return; n = vq_getchain(vq, &idx, &iov, 1, NULL); - assert(n == 1); memcpy(iov.iov_base, ctrl, sizeof(struct pci_vtcon_control)); @@ -563,7 +563,8 @@ struct pci_vtcon_softc *sc; struct pci_vtcon_port *port; struct iovec iov[1]; - uint16_t idx, n; + int n; + uint16_t idx; uint16_t flags[8]; sc = vsc; @@ -571,7 +572,7 @@ while (vq_has_descs(vq)) { n = vq_getchain(vq, &idx, iov, 1, flags); - assert(n >= 1); + assert(n == 1); if (port != NULL) port->vsp_cb(port, port->vsp_arg, iov, 1); --- usr.sbin/bhyve/pci_virtio_rnd.c.orig +++ usr.sbin/bhyve/pci_virtio_rnd.c @@ -109,7 +109,7 @@ { struct iovec iov; struct pci_vtrnd_softc *sc; - int len; + int len, n; uint16_t idx; sc = vsc; @@ -120,7 +120,8 @@ } while (vq_has_descs(vq)) { - vq_getchain(vq, &idx, &iov, 1, NULL); + n = vq_getchain(vq, &idx, &iov, 1, NULL); + assert(n == 1); len = read(sc->vrsc_fd, iov.iov_base, iov.iov_len);