aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2013-09-12 12:55:10 +0100
committerTim Deegan <tim@xen.org>2013-09-12 17:48:01 +0100
commite58015acaf53b179847db94524fb2a9f4399b5e6 (patch)
treee984d45b33ef654b56f0b42bff3c1280b8d97f8c /xen/drivers
parentbc230d5dcabf31c6db82916df7d0b98ca11fbaad (diff)
downloadxen-e58015acaf53b179847db94524fb2a9f4399b5e6.tar.gz
xen-e58015acaf53b179847db94524fb2a9f4399b5e6.tar.bz2
xen-e58015acaf53b179847db94524fb2a9f4399b5e6.zip
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@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/drivers')
-rw-r--r--xen/drivers/char/ehci-dbgp.c3
1 files changed, 3 insertions, 0 deletions
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]);