summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs/inode.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-07-15 18:28:36 +0000
committermckusick <mckusick@FreeBSD.org>2000-07-15 18:28:36 +0000
commita40b145d3c81a7ae0f1191e528de8e80333001fd (patch)
tree74272fe4f2a6926f275e6679313587a65b2ac4f0 /sbin/fsck_ifs/inode.c
parenta6eab227616d406c63fc686cef5971a1e47f29a0 (diff)
downloadFreeBSD-src-a40b145d3c81a7ae0f1191e528de8e80333001fd.zip
FreeBSD-src-a40b145d3c81a7ae0f1191e528de8e80333001fd.tar.gz
Make a tighter test for valid inode numbers in getnextinode().
Diffstat (limited to 'sbin/fsck_ifs/inode.c')
-rw-r--r--sbin/fsck_ifs/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/fsck_ifs/inode.c b/sbin/fsck_ifs/inode.c
index e241cdb..8b2f14b 100644
--- a/sbin/fsck_ifs/inode.c
+++ b/sbin/fsck_ifs/inode.c
@@ -307,7 +307,7 @@ ginode(inumber)
* Special purpose version of ginode used to optimize first pass
* over all the inodes in numerical order.
*/
-ino_t nextino, lastinum;
+ino_t nextino, lastinum, lastvalidinum;
long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
struct dinode *inodebuf;
@@ -319,7 +319,7 @@ getnextinode(inumber)
ufs_daddr_t dblk;
static struct dinode *dp;
- if (inumber != nextino++ || inumber > maxino)
+ if (inumber != nextino++ || inumber > lastvalidinum)
errx(EEXIT, "bad inode number %d to nextinode", inumber);
if (inumber >= lastinum) {
readcnt++;
@@ -348,6 +348,7 @@ setinodebuf(inum)
if (inum % sblock.fs_ipg != 0)
errx(EEXIT, "bad inode number %d to setinodebuf", inum);
+ lastvalidinum = inum + sblock.fs_ipg - 1;
startinum = 0;
nextino = inum;
lastinum = inum;
OpenPOWER on IntegriCloud