NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/60053
The following reply was made to PR kern/60053; it has been noted by GNATS.
From: ssszcmawo <ssszcmawo%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/60053
Date: Wed, 4 Mar 2026 12:30:14 +0100
A little update on it, made error messages more specific
>From 94b47742f640bf789de8d9c98ce1ffb80fa825ee Mon Sep 17 00:00:00 2001
From: ssszcmawo <belan2470%gmail.com@localhost>
Date: Tue, 3 Mar 2026 15:29:53 +0100
Subject: [PATCH] add additional check for huge files and improve comments
Add validation for inconsistent EXT2_HUGE_FILE usage and clarify
related comments and error messages
---
sbin/fsck_ext2fs/inode.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c
index 97f02b84a..f3d4d37f3 100644
--- a/sbin/fsck_ext2fs/inode.c
+++ b/sbin/fsck_ext2fs/inode.c
@@ -600,7 +600,8 @@ findname(struct inodesc *idesc)
/* from utilities.c namebuf[] variable */
char *buf = __UNCONST(idesc->id_name);
if (namlen > MAXPATHLEN) {
- /* XXX: Prevent overflow but don't fix */
+ /* XXX: Prevent overflow but don't fix */
+ printf("entry name truncated to %d characters", MAXPATHLEN);
namlen = MAXPATHLEN;
}
@@ -755,25 +756,34 @@ freeino(ino_t ino)
n_files--;
}
+/*
+ * read the number of block from inode
+ */
uint64_t
inonblock(struct ext2fs_dinode *dp)
{
uint64_t nblock;
-
- /* XXX check for EXT2_HUGE_FILE without EXT2F_ROCOMPAT_HUGE_FILE? */
+ uint32_t flags;
nblock = fs2h32(dp->e2di_nblock);
+ flags = fs2h32(dp->e2di_flags);
- if ((sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)) {
- nblock |= (uint64_t)fs2h16(dp->e2di_nblock_high) << 32;
- if (fs2h32(dp->e2di_flags) & EXT2_HUGE_FILE) {
- nblock = EXT2_FSBTODB(&sblock, nblock);
- }
+ if ((flags & EXT2_HUGE_FILE) &&
+ !(sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)) {
+ pfatal("inode has EXT2_HUGE_FILE but ro-compat feature is not
enabled");
}
+ if (sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)
+ nblock |= (uint64_t)fs2h16(dp->e2di_nblock_high) << 32;
+
+ if (flags & EXT2_HUGE_FILE)
+ nblock = EXT2_FSBTODB(&sblock, nblock);
return nblock;
}
+/*
+ * set the number of block in an inode
+ */
void
inosnblock(struct ext2fs_dinode *dp, uint64_t nblock)
{
--
2.47.3
Home |
Main Index |
Thread Index |
Old Index