Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0304EC4332F for ; Thu, 5 May 2022 09:26:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2BA5B83EEE; Thu, 5 May 2022 11:26:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=geanix.com header.i=@geanix.com header.b="Ry77Aace"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0F11683EFC; Thu, 5 May 2022 11:26:53 +0200 (CEST) Received: from first.geanix.com (first.geanix.com [116.203.34.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A651783D7D for ; Thu, 5 May 2022 11:26:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean@geanix.com Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id 15EB91245EAB; Thu, 5 May 2022 09:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1651742809; bh=grpM3vkbAK/JOrobwYd9XI5FjjW0olqONOC1TWmp07M=; h=From:To:Cc:Subject:Date; b=Ry77AaceC5959KHzFKBXWq9om9KlhHxl8wnOixEDv3BWjuT9TMiQdGevhBZm/f/tX A4Jh3Wa//gPurhd23UlMhTZ7GYPCeqHKdZrsdeIUI0hOZhbP+8fDcnVr56V2QGDApA LqKDZM3ukwXG9LgEJGAiZu2ptp+IRA5lNS0rcrU0JrtX6DlhH7MWy3QQaSBFi/ZYDl FwMNvWXvm16IgTx4Xz90jvsiyarXOWiBWV5FrbFDJmAZ8/jN8PlYP0pTntpTMzQ9SI bb6uNV5zOgIUol/xa9+V1Rd870DqwFWQ+UGXiFBmnzoiWtvRcN3BwUYsk3PnoOuQba /cRWpbnpYFOYA== From: Sean Nyekjaer To: u-boot@lists.denx.de Cc: Sean Nyekjaer , trini@konsulko.com Subject: [PATCH] fs/squashfs: use do_div function for math Date: Thu, 5 May 2022 11:26:37 +0200 Message-Id: <20220505092637.1856223-1-sean@geanix.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Sean Nyekjaer 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 --- 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 5d9c52af80..6405db4ff3 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -1440,7 +1441,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, } for (j = 0; j < datablk_count; j++) { - start = data_offset / ctxt.cur_dev->blksz; + start = do_div(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 = do_div(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); -- 2.35.1