From: deraadt Date: Sun, 6 Apr 1997 06:04:26 +0000 (+0000) Subject: correct labelsector confusion X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f587e3dc01131ae5b3be5124b0221fff922def14;p=openbsd correct labelsector confusion --- diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c index 105ba2c8acc..cebc0712135 100644 --- a/sys/arch/arc/arc/disksubr.c +++ b/sys/arch/arc/arc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.9 1997/04/05 21:56:04 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.10 1997/04/06 06:04:29 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -410,12 +410,12 @@ bounds_check_with_label(bp, lp, wlabel) struct disklabel *lp; int wlabel; { +#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); - int labelsector = lp->d_partitions[RAW_PART].p_offset + LABELSECTOR; + int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) + + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); -#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { sz = blockpersec(p->p_size, lp) - bp->b_blkno; if (sz == 0) { diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 130a49574da..8343d0f6fd8 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.18 1997/04/05 21:56:02 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.19 1997/04/06 06:04:26 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -410,12 +410,12 @@ bounds_check_with_label(bp, lp, wlabel) struct disklabel *lp; int wlabel; { +#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); - int labelsector = lp->d_partitions[RAW_PART].p_offset + LABELSECTOR; + int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) + + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); -#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { sz = blockpersec(p->p_size, lp) - bp->b_blkno; if (sz == 0) {