git: c8a7a3ffe120 - main - Fix bug in expanding lost+found direct blocks.

Kirk McKusick mckusick at FreeBSD.org
Thu Jan 7 00:30:58 UTC 2021


The branch main has been updated by mckusick:

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

commit c8a7a3ffe120d0d44a39e69466c088d5862e6f5c
Author:     Kirk McKusick <mckusick at FreeBSD.org>
AuthorDate: 2021-01-07 00:31:33 +0000
Commit:     Kirk McKusick <mckusick at FreeBSD.org>
CommitDate: 2021-01-07 00:35:01 +0000

    Fix bug in expanding lost+found direct blocks.
    
    Reported by:  Peter Holm
    Sponsored by: Netflix
---
 sbin/fsck_ffs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 044a7b0f13a9..a86d65a9f183 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -657,7 +657,7 @@ expanddir(union dinode *dp, char *name)
 	 * If last block is a fragment, expand it to a full size block.
 	 */
 	lastlbnsize = sblksize(&sblock, filesize, lastlbn);
-	if (lastlbnsize < sblock.fs_bsize) {
+	if (lastlbnsize > 0 && lastlbnsize < sblock.fs_bsize) {
 		oldblk = DIP(dp, di_db[lastlbn]);
 		bp = getdirblk(oldblk, lastlbnsize);
 		if (bp->b_errs)


More information about the dev-commits-src-all mailing list