summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-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);