From f587e3dc01131ae5b3be5124b0221fff922def14 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 6 Apr 1997 06:04:26 +0000 Subject: [PATCH] correct labelsector confusion --- sys/arch/arc/arc/disksubr.c | 8 ++++---- sys/arch/i386/i386/disksubr.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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) { -- 2.20.1