summaryrefslogtreecommitdiff
path: root/sys/arch/arm32
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/arm32
parent686c4b6f344a5a27aa0ff9967507d7d8aea15be1 (diff)
check for lp->d_secpercyl == 0) in bounds_check_with_label()
Diffstat (limited to 'sys/arch/arm32')
-rw-r--r--sys/arch/arm32/arm32/disksubr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/arch/arm32/arm32/disksubr.c b/sys/arch/arm32/arm32/disksubr.c
index aea222b325a..9cb3ee1f4c0 100644
--- a/sys/arch/arm32/arm32/disksubr.c
+++ b/sys/arch/arm32/arm32/disksubr.c
@@ -526,6 +526,12 @@ bounds_check_with_label(bp, lp, osdep, wlabel)
int labelsector = lp->d_partitions[0].p_offset + LABELSECTOR;
int sz;
+ /* avoid division by zero */
+ if (lp->d_secpercyl == 0) {
+ bp->b_error = EINVAL;
+ goto bad;
+ }
+
sz = howmany(bp->b_bcount, lp->d_secsize);
if (bp->b_blkno + sz > p->p_size) {