From cea912f1d50bba2f837b3a5d588cc238c779d84e Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Sun, 16 Dec 2007 20:57:18 +0000 Subject: panic on negative blkno or size; ok kettenis@ deraadt@ --- sys/kern/subr_disk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/kern/subr_disk.c') 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; -- cgit v1.2.3