Skip to contentSkip to conversation

erofs-utils: lib: fix insufficient fragment cache bitmap

PATCH New Gao Xiang 1 participant 1 message Mar 8, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: fix insufficient fragment cache bitmap

.. should round up to the nearest byte instead of down.

Fixes f511cfbbc0da ("erofs-utils: introduce fragment cache")
---
 lib/fragments.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/fragments.c +1 -1
index 05bbf0d..d300439 100644
@@ -402,7 +402,7 @@ int erofs_packedfile_init(struct erofs_sb_info *sbi, bool fragments_mkfs)
 			err = -errno;
 			goto err_out;
 		}
-		epi->uptodate_size = BLK_ROUND_UP(sbi, ei.i_size) / 8;
+		epi->uptodate_size = DIV_ROUND_UP(BLK_ROUND_UP(sbi, ei.i_size), 8);
 		epi->uptodate = calloc(1, epi->uptodate_size);
 		if (!epi->uptodate) {
 			err = -ENOMEM;
Signature · 1 line
2.43.5