Author: araujo
Date: Tue May 15 05:55:29 2018
New Revision: 333622
URL: https://svnweb.freebsd.org/changeset/base/333622

Log:
  vq_getchain() can return -1 if some descriptor(s) are invalid and prints
  a diagnostic message. So we do a sanity checking on the return value
  of vq_getchain().
  
  Spotted by:   gcc49
  Reviewed by:  avg
  MFC after:    4 weeks
  Sponsored by: iXsystems Inc.
  Differential Revision:        https://reviews.freebsd.org/D15388

Modified:
  head/usr.sbin/bhyve/pci_virtio_console.c

Modified: head/usr.sbin/bhyve/pci_virtio_console.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_console.c    Tue May 15 04:31:11 2018        
(r333621)
+++ head/usr.sbin/bhyve/pci_virtio_console.c    Tue May 15 05:55:29 2018        
(r333622)
@@ -579,6 +579,7 @@ pci_vtcon_notify_tx(void *vsc, struct vqueue_info *vq)
 
        while (vq_has_descs(vq)) {
                n = vq_getchain(vq, &idx, iov, 1, flags);
+               assert(n >= 1);
                if (port != NULL)
                        port->vsp_cb(port, port->vsp_arg, iov, 1);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to