From: Tim Deegan Date: Thu, 12 Sep 2013 11:55:10 +0000 (+0100) Subject: ehci-dbgp: avoid division by zero. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6374 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e58015acaf53b179847db94524fb2a9f4399b5e6;p=xen.git 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 Reviewed-by: Andrew Cooper Acked-by: Jan Beulich --- diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c index 301eedf22e..b900d6092e 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]);