From 58ced38ac46976c1b0dfa91c513c8ccd170b4e26 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 21 May 2019 00:18:20 +0200 Subject: fix: inode number difference in dirent is actually signed For now, it is enough to reduce the comparison value, since the inode numbers are increasing. Signed-off-by: David Oberhollenzer --- mkfs/meta.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkfs/meta.c b/mkfs/meta.c index a0ea071..4ef570d 100644 --- a/mkfs/meta.c +++ b/mkfs/meta.c @@ -97,7 +97,9 @@ static int write_dir(meta_writer_t *dm, dir_info_t *dir, dir_index_t **index) for (d = c; d != NULL; d = d->next) { if ((d->inode_ref >> 16) != (c->inode_ref >> 16)) break; - if ((d->inode_num - c->inode_num) > 0xFFFF) + + /* XXX: difference is actually signed */ + if ((d->inode_num - c->inode_num) > 0x7FFF) break; size += sizeof(ent) + strlen(c->name); -- cgit v1.2.3