diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-12-16 20:57:18 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-12-16 20:57:18 +0000 |
commit | cea912f1d50bba2f837b3a5d588cc238c779d84e (patch) | |
tree | 3561d83972fc353c6ffbc039cbe3ae7f936bb7fd | |
parent | f4e28a5b130c27ce8fced9f84bbd4aa5e1f11700 (diff) |
panic on negative blkno or size; ok kettenis@ deraadt@
-rw-r--r-- | sys/kern/subr_disk.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 52f0c4df054..2bf6f11b7e0 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.66 2007/11/09 11:32:57 jsing Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.67 2007/12/16 20:57:17 otto Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -615,6 +615,9 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) if (lp->d_secpercyl == 0) goto bad; + if (bp->b_blkno < 0 || sz < 0) + panic("bounds_check_with_label %lld %lld\n", bp->b_blkno, sz); + /* beyond partition? */ if (bp->b_blkno + sz > blockpersec(DL_GETPSIZE(p), lp)) { sz = blockpersec(DL_GETPSIZE(p), lp) - bp->b_blkno; |