Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2022 06:10:57 GMT
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b2af9ad17124 - stable/13 - Correctness cleanups in fsck_ffs(8).
Message-ID:  <202212040610.2B46Av6r010603@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=b2af9ad171243a897a341ec3aefc5f2ea099e336

commit b2af9ad171243a897a341ec3aefc5f2ea099e336
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-08-13 20:27:37 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-12-04 05:46:51 +0000

    Correctness cleanups in fsck_ffs(8).
    
    (cherry picked from commit 6e821c35d68d4041640b27419837464ffab65cff)
    
    Sponsored by: The FreeBSD Foundation
---
 sbin/fsck_ffs/inode.c | 3 +++
 sbin/fsck_ffs/setup.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index dafc99bd92da..ccfe8782ac88 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -474,6 +474,9 @@ void
 irelse(struct inode *ip)
 {
 
+	/* Check for failed inode read */
+	if (ip->i_bp == NULL)
+		return;
 	if (ip->i_bp->b_refcnt <= 0)
 		pfatal("irelse: releasing unreferenced ino %ju\n",
 		    (uintmax_t) ip->i_number);
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 14b34962d3fe..05c044395436 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -174,6 +174,7 @@ setup(char *dev)
 	/*
 	 * allocate and initialize the necessary maps
 	 */
+	bufinit();
 	bmapsize = roundup(howmany(maxfsblock, CHAR_BIT), sizeof(short));
 	blockmap = Calloc((unsigned)bmapsize, sizeof (char));
 	if (blockmap == NULL) {
@@ -198,7 +199,6 @@ setup(char *dev)
 		    (uintmax_t)numdirs * sizeof(struct inoinfo *));
 		goto badsb;
 	}
-	bufinit();
 	if (sblock.fs_flags & FS_DOSOFTDEP)
 		usedsoftdep = 1;
 	else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212040610.2B46Av6r010603>