summaryrefslogtreecommitdiff
path: root/sys/arch/kbus
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-01-08 04:29:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-01-08 04:29:12 +0000
commit35c2bff255654ea2902e9b996e5711d755659967 (patch)
treed3bb71382e3fd610b239be8889b28e5745ff07db /sys/arch/kbus
parent686c4b6f344a5a27aa0ff9967507d7d8aea15be1 (diff)
check for lp->d_secpercyl == 0) in bounds_check_with_label()
Diffstat (limited to 'sys/arch/kbus')
-rw-r--r--sys/arch/kbus/kbus/disksubr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/kbus/kbus/disksubr.c b/sys/arch/kbus/kbus/disksubr.c
index b88ee680f00..52be09fc670 100644
--- a/sys/arch/kbus/kbus/disksubr.c
+++ b/sys/arch/kbus/kbus/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.3 1998/10/03 21:18:55 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.4 1999/01/08 04:29:06 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -267,6 +267,12 @@ bounds_check_with_label(bp, lp, osdep, wlabel)
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int sz = howmany(bp->b_bcount, DEV_BSIZE);
+ /* avoid division by zero */
+ if (lp->d_secpercyl == 0) {
+ bp->b_error = EINVAL;
+ goto bad;
+ }
+
/* overwriting disk label ? */
/* XXX should also protect bootstrap in first 8K */
/* XXX this assumes everything <=LABELSECTOR is label! */