Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/next68k/stand/boot Avoid possible division by zero ...
details: https://anonhg.NetBSD.org/src/rev/b994212af8ef
branches: trunk
changeset: 373434:b994212af8ef
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Thu Feb 09 14:41:54 2023 +0000
description:
Avoid possible division by zero trap in error cases to make debug easier.
diffstat:
sys/arch/next68k/stand/boot/sd.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diffs (20 lines):
diff -r ed83051ddbae -r b994212af8ef sys/arch/next68k/stand/boot/sd.c
--- a/sys/arch/next68k/stand/boot/sd.c Thu Feb 09 14:09:47 2023 +0000
+++ b/sys/arch/next68k/stand/boot/sd.c Thu Feb 09 14:41:54 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.13 2023/02/04 14:38:09 tsutsui Exp $ */
+/* $NetBSD: sd.c,v 1.14 2023/02/09 14:41:54 tsutsui Exp $ */
/*
* Copyright (c) 1994 Rolf Grossmann
* All rights reserved.
@@ -135,6 +135,10 @@
return error<0 ? EHER : error;
blklen = (cap.length[0]<<24) + (cap.length[1]<<16)
+ (cap.length[2]<<8) + cap.length[3];
+
+ /* avoid division by zero trap even on possible xfer errors */
+ if (blklen == 0)
+ blklen = DEV_BSIZE;
ss->sc_dev_bsize = blklen;
ss->sc_pinfo.offset[ss->sc_part] = 0; /* read absolute sector */
Home |
Main Index |
Thread Index |
Old Index