summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
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/hp300
parent686c4b6f344a5a27aa0ff9967507d7d8aea15be1 (diff)
check for lp->d_secpercyl == 0) in bounds_check_with_label()
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/hp300/disksubr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
index 16131108550..97e730a708b 100644
--- a/sys/arch/hp300/hp300/disksubr.c
+++ b/sys/arch/hp300/hp300/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.11 1998/10/04 20:35:16 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.12 1999/01/08 04:29:05 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
/*
@@ -239,6 +239,12 @@ bounds_check_with_label(bp, lp, osdep, wlabel)
LABELSECTOR;
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? */
if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsect &&
(bp->b_flags & B_READ) == 0 && !wlabel) {