[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] ehci-dbgp: avoid division by zero.



commit e58015acaf53b179847db94524fb2a9f4399b5e6
Author:     Tim Deegan <tim@xxxxxxx>
AuthorDate: Thu Sep 12 12:55:10 2013 +0100
Commit:     Tim Deegan <tim@xxxxxxx>
CommitDate: Thu Sep 12 17:48:01 2013 +0100

    ehci-dbgp: avoid division by zero.
    
    Unlikely to ever see hardware reporting 0 ports, but might as well
    fail gracefully if we do.
    
    Coverity CID 1055266
    
    Signed-off-by: Tim Deegan <tim@xxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/char/ehci-dbgp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c
index 301eedf..b900d60 100644
--- a/xen/drivers/char/ehci-dbgp.c
+++ b/xen/drivers/char/ehci-dbgp.c
@@ -1094,6 +1094,9 @@ try_next_port:
     dbgp_printk("n_ports:    %u\n", n_ports);
     ehci_dbgp_status(dbgp, "");
 
+    if ( n_ports == 0 )
+        return -1;
+
     for ( i = 1; i <= n_ports; i++ )
     {
         portsc = readl(&dbgp->ehci_regs->port_status[i-1]);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.