Module Name:    src
Committed By:   dholland
Date:           Tue May 31 03:25:46 UTC 2016

Modified Files:
        src/sys/arch/mvme68k/mvme68k: machdep.c

Log Message:
PR 50792 David Binderman: make sure we don't divide by zero.

The loop that picks delay_divisor might conceivably reject all values,
particularly if the hardware is sulking for some reason; in that case
it'll be left zero. Use 1 instead of 0 so we don't then crash.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mvme68k/mvme68k/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mvme68k/mvme68k/machdep.c
diff -u src/sys/arch/mvme68k/mvme68k/machdep.c:1.153 src/sys/arch/mvme68k/mvme68k/machdep.c:1.154
--- src/sys/arch/mvme68k/mvme68k/machdep.c:1.153	Mon Mar 24 19:52:27 2014
+++ src/sys/arch/mvme68k/mvme68k/machdep.c	Tue May 31 03:25:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.154 2016/05/31 03:25:46 dholland Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -309,6 +309,10 @@ mvme147_init(void)
 		bus_space_write_1(bt, bh, PCCREG_TMR1_CONTROL, PCC_TIMERCLEAR);
 		/* retry! */
 	}
+	/* just in case */
+	if (delay_divisor == 0) {
+		delay_divisor = 1;
+	}
 
 	bus_space_unmap(bt, bh, PCCREG_SIZE);
 

Reply via email to