git: e15d8f238461 - main - Updates to UFS/FFS superblock integrity checks when reading a superblock.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Sun, 04 Dec 2022 05:34:27 UTC
The branch main has been updated by mckusick:

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

commit e15d8f238461de9bca1fa37cc4ef06d84a4edd4f
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-12-04 05:33:09 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-12-04 05:33:59 +0000

    Updates to UFS/FFS superblock integrity checks when reading a superblock.
    
    Minor optimization that makes semantics of check clearer.
    
    Sponsored by: The FreeBSD Foundation
---
 sys/ufs/ffs/ffs_subr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index 67f4fcd92fd8..705f8c9c961d 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -407,7 +407,7 @@ validate_sblock(struct fs *fs, int flags)
 		FCHK(powerof2(fs->fs_fsize), ==, 0, %jd);
 		FCHK(fs->fs_sbsize, >, SBLOCKSIZE, %jd);
 		FCHK(fs->fs_sbsize, <, (signed)sizeof(struct fs), %jd);
-		FCHK(fs->fs_sbsize % dbtob(1), !=, 0, %jd);
+		FCHK(fs->fs_sbsize % sectorsize, !=, 0, %jd);
 		FCHK(fs->fs_fpg, <, 3 * fs->fs_frag, %jd);
 		FCHK(fs->fs_ncg, <, 1, %jd);
 		FCHK(fs->fs_fsbtodb, !=, ILOG2(fs->fs_fsize / sectorsize), %jd);
@@ -505,7 +505,7 @@ validate_sblock(struct fs *fs, int flags)
 	 */
 	if (error)
 		return (error);
-	FCHK(fs->fs_sbsize % dbtob(1), !=, 0, %jd);
+	FCHK(fs->fs_sbsize % sectorsize, !=, 0, %jd);
 	FCHK(fs->fs_ipg % fs->fs_inopb, !=, 0, %jd);
 	FCHK(fs->fs_sblkno, !=, roundup(
 	    howmany(fs->fs_sblockloc + SBLOCKSIZE, fs->fs_fsize),