diff options
| author | Yuta Hayama <hayama@lineo.co.jp> | 2026-02-13 14:55:22 +0100 |
|---|---|---|
| committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2026-04-13 07:32:41 +0200 |
| commit | a505a2cc56acf493607fdf24cbf129393a0873fa (patch) | |
| tree | fc5c9bce375e974413051bafee835f7767102255 /ubifs-utils/fsck.ubifs/check_files.c | |
| parent | a75782ee97eb5940c865fd560d846b9a93ed9122 (diff) | |
fsck.ubifs: fix platform dependant ino_t and loff_t formatting
On architectures such as armv7-a, ino_t and loff_t are unsigned long long rather than
unsigned long. In such cases, the printf format specifier "%lu" is not
appropriate and causes an incorrect address offset.
mtd-utils/ubifs-utils/fsck.ubifs/problem.c:224
log_out(c, "problem: %s, ino %lu, unreachable dentry %s, type %s%s",
problem->desc, ifp->file->inum,
c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name,
ubifs_get_type_name(dent_node->type),
key_type(c, &dent_node->key) == UBIFS_XENT_KEY ? "(xattr)" : "");
fsck.ubifs[484] (/dev/ubi0_0,danger mode): problem: Dentry is unreachable, ino 917, unreachable dentry (null), type checksum_typefile
Furthermore, running fsck.ubifs with the --debug=4 option will almost
certainly cause a SEGV at the following point.
mtd-utils/ubifs-utils/fsck.ubifs/check_files.c:103
dbg_fsck("construct file(%lu) for %s node, TNC location %d:%d, in %s",
inum, ubifs_get_key_name(key_type(c, key)), sn->lnum, sn->offs,
c->dev_name);
To ensure functionality regardless of environment, cast ino_t to unsigned
long, since it will never be more than 4 bytes.
For loff_t, use %lld and cast accordingly.
Signed-off-by: Yuta Hayama <hayama@lineo.co.jp>
Signed-off-by: Tomas Alvarez Vanoli <tomas.alvarez-vanoli@hitachienergy.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/fsck.ubifs/check_files.c')
| -rw-r--r-- | ubifs-utils/fsck.ubifs/check_files.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ubifs-utils/fsck.ubifs/check_files.c b/ubifs-utils/fsck.ubifs/check_files.c index 54300a3..615f6bc 100644 --- a/ubifs-utils/fsck.ubifs/check_files.c +++ b/ubifs-utils/fsck.ubifs/check_files.c @@ -98,8 +98,8 @@ static int construct_file(struct ubifs_info *c, union ubifs_key *key, } dbg_fsck("construct file(%lu) for %s node, TNC location %d:%d, in %s", - inum, ubifs_get_key_name(key_type(c, key)), sn->lnum, sn->offs, - c->dev_name); + (unsigned long)inum, ubifs_get_key_name(key_type(c, key)), + sn->lnum, sn->offs, c->dev_name); return insert_or_update_file(c, tree, sn, key_type(c, key), inum); } @@ -341,7 +341,8 @@ void update_files_size(struct ubifs_info *c) if (file && file->ino.header.exist && file->ino.size < e->d_size) { dbg_fsck("update file(%lu) size %llu->%llu, in %s", - e->inum, file->ino.size, + (unsigned long)e->inum, + file->ino.size, (unsigned long long)e->d_size, c->dev_name); file->ino.size = e->d_size; |
