From b702ed6fb4bdbfc883da5e2e473f986d352f66c9 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 25 Oct 2017 00:36:46 +0100 Subject: [PATCH] fsck: fix wrap on full sized fs Noticed by Brett --- Applications/util/fsck.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Applications/util/fsck.c b/Applications/util/fsck.c index f708fd9d..1461a9f8 100644 --- a/Applications/util/fsck.c +++ b/Applications/util/fsck.c @@ -246,12 +246,13 @@ int main(int argc, char **argv) if (!yes()) exit(error | 32); - bitmap = calloc((swizzle16(superblock.s_fsize) + 7) / 8, sizeof(char)); + bitmap = calloc((swizzle16(superblock.s_fsize) + 7UL) / 8, sizeof(char)); linkmap = (int16_t *) calloc(8 * swizzle16(superblock.s_isize), sizeof(int16_t)); printf("Memory pool %d bytes\n", 16 * swizzle16(superblock.s_isize) + - swizzle16(superblock.s_fsize + 7) / 8); + swizzle16(superblock.s_fsize + 7UL) / 8); + if (!bitmap || !linkmap) { fprintf(stderr, "Not enough memory.\n"); exit(error | 8); -- 2.34.1