Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci PR/49927: Robert Millan: Avoid zerodivide on emu...



details:   https://anonhg.NetBSD.org/src/rev/fda3355aa4c3
branches:  trunk
changeset: 338431:fda3355aa4c3
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 24 14:56:57 2015 +0000

description:
PR/49927: Robert Millan: Avoid zerodivide on emulated hardware.

diffstat:

 sys/dev/pci/auich.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 29f8fcd044ee -r fda3355aa4c3 sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Sun May 24 14:55:12 2015 +0000
+++ b/sys/dev/pci/auich.c       Sun May 24 14:56:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $     */
+/*     $NetBSD: auich.c,v 1.147 2015/05/24 14:56:57 christos Exp $     */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.147 2015/05/24 14:56:57 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1709,6 +1709,13 @@
                return;
        }
 
+       if (wait_us == 0) {
+               /* Can happen with emulated hardware */
+               aprint_error_dev(sc->sc_dev, "abnormal zero delay during "
+                   "calibration\n");
+               return;
+       }
+
        rnd_add_data(NULL, &wait_us, sizeof(wait_us), 1);
 
        actual_48k_rate = (bytes * UINT64_C(250000)) / wait_us;



Home | Main Index | Thread Index | Old Index