diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-05-31 22:06:04 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-05-31 22:06:04 +0000 |
commit | 7ba43246d7656e2cd061f11f30091e6d3821fc3c (patch) | |
tree | 538bd89edb30b239823bea9f36487687c0bb5991 /sys/arch/hp300 | |
parent | 64b6e1f42416eed2e377df185f68116b4515116b (diff) |
Minor bounds_check_with_label nits.
1) Use local variable 'labelsector' not 'labelsect' to be consistant (hp300,
mac68k, mvme68k, mvme88k, vax).
2) Having checked for sz == 0, the next check needs only be sz < 0, not <= 0.
(mac68k, mvme68k, mvme88k)
3) Use lp->d_partitions + DISKPART(dev), rather than
lp->d_partitions[DISKPART(dev)] (hp300).
Assuming no typos there should be no functional change.
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r-- | sys/arch/hp300/hp300/disksubr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 9704f6a8b9d..fa1c307352d 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.27 2007/05/31 19:57:43 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.28 2007/05/31 22:06:02 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -232,8 +232,8 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, struct cpu_disklabel *osdep, int wlabel) { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - struct partition *p = &lp->d_partitions[DISKPART(bp->b_dev)]; - int labelsect = blockpersec(lp->d_partitions[0].p_offset, lp) + + struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); + int labelsector = blockpersec(lp->d_partitions[0].p_offset, lp) + LABELSECTOR; int sz = howmany(bp->b_bcount, DEV_BSIZE); @@ -244,7 +244,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, } /* Overwriting disk label? */ - if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsect && + if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector && (bp->b_flags & B_READ) == 0 && !wlabel) { bp->b_error = EROFS; goto bad; |