From 92080c6ef6c753ca69c53f191a6baef53f98bd6b Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Thu, 12 May 2022 20:37:14 +0200 Subject: [PATCH] fs/squashfs: use lldiv function for math MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compling for x86: ld.bfd: fs/squashfs/sqfs.o: in function `sqfs_read': u-boot/fs/squashfs/sqfs.c:1443: undefined reference to `__udivmoddi4' ld.bfd: u-boot/fs/squashfs/sqfs.c:1521: undefined reference to `__udivmoddi4' Signed-off-by: Sean Nyekjaer Reviewed-by: Miquel Raynal Reviewed-by: Pali Rohár --- fs/squashfs/sqfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index b07c41e911..b4484fa17f 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -1442,7 +1443,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, for (j = 0; j < datablk_count; j++) { char *data_buffer; - start = data_offset / ctxt.cur_dev->blksz; + start = lldiv(data_offset, ctxt.cur_dev->blksz); table_size = SQFS_BLOCK_SIZE(finfo.blk_sizes[j]); table_offset = data_offset - (start * ctxt.cur_dev->blksz); n_blks = DIV_ROUND_UP(table_size + table_offset, @@ -1516,7 +1517,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, goto out; } - start = frag_entry.start / ctxt.cur_dev->blksz; + start = lldiv(frag_entry.start, ctxt.cur_dev->blksz); table_size = SQFS_BLOCK_SIZE(frag_entry.size); table_offset = frag_entry.start - (start * ctxt.cur_dev->blksz); n_blks = DIV_ROUND_UP(table_size + table_offset, ctxt.cur_dev->blksz);