summaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-11-21 22:24:25 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-11-21 22:24:25 +0000
commitaa7ba4d60a47c5848bd68420bde3af167d9b1c41 (patch)
tree84f270698e44360082718747592055f72b51bf4b /sys/ufs
parentbaaeb2e9ba83449a40f23f0f9d8080cc55041de6 (diff)
Added sanity checks
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_bmap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c
index c688fa665b7..add641e15ce 100644
--- a/sys/ufs/ufs/ufs_bmap.c
+++ b/sys/ufs/ufs/ufs_bmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_bmap.c,v 1.9 2000/06/23 02:14:39 mickey Exp $ */
+/* $OpenBSD: ufs_bmap.c,v 1.10 2001/11/21 22:24:24 csapuntz Exp $ */
/* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */
/*
@@ -243,6 +243,13 @@ ufs_getlbns(vp, bn, ap, nump)
if ((long)bn < 0)
bn = -(long)bn;
+#ifdef DIAGNOSTIC
+ if (realbn < 0 && realbn > -NDADDR) {
+ panic ("ufs_getlbns: Invalid indirect block %d specified\n",
+ realbn);
+ }
+#endif
+
/* The first NDADDR blocks are direct blocks. */
if (bn < NDADDR)
return (0);
@@ -293,6 +300,11 @@ ufs_getlbns(vp, bn, ap, nump)
metalbn -= -1 + off * blockcnt;
}
+#ifdef DIAGNOSTIC
+ if (realbn < 0 && metalbn != realbn) {
+ panic("ufs_getlbns: indirect block %d not found", realbn);
+ }
+#endif
if (nump)
*nump = numlevels;
return (0);