]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs/squashfs: use lldiv function for math
authorSean Nyekjaer <sean.nyekjaer.ext@siemensgamesa.com>
Thu, 12 May 2022 18:37:14 +0000 (20:37 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 23 May 2022 13:33:10 +0000 (09:33 -0400)
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 <sean.nyekjaer.ext@siemensgamesa.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
fs/squashfs/sqfs.c

index b07c41e91170743ffd2a55033b91519c14dcc3a6..b4484fa17f59dc0baab7ad60d130c0624be0bde3 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <asm/unaligned.h>
+#include <div64.h>
 #include <errno.h>
 #include <fs.h>
 #include <linux/types.h>
@@ -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);