diff options
Diffstat (limited to 'sys/arch/amiga')
-rw-r--r-- | sys/arch/amiga/amiga/disksubr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index 4a75f4a6442..088aa8317b1 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.17 1998/10/03 21:18:54 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.18 1999/01/08 04:29:04 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.27 1996/10/13 03:06:34 christos Exp $ */ /* @@ -517,6 +517,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; + } + if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { sz = blockpersec(p->p_size, lp) - bp->b_blkno; if (sz == 0) { |