From mboxrd@z Thu Jan 1 00:00:00 1970 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 0FDDFC433F5 for ; Mon, 9 May 2022 13:08:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D288080107; Mon, 9 May 2022 15:08:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.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=bootlin.com header.i=@bootlin.com header.b="HtV0aIqQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2060783E14; Mon, 9 May 2022 15:08:20 +0200 (CEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 24AFC8008A for ; Mon, 9 May 2022 15:08:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 0EC092000A; Mon, 9 May 2022 13:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652101696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QzYtEnsbnbw7GJcO3cjjD6xe3971LtYua++lgSDyiX8=; b=HtV0aIqQC9PSx8mwjURgBt57R1DvPmsNuDDjF56pTxt/BZ0Q04m/bCQWlNlAy521QD2SR0 X4ppak3O2JeMtnOnqZcAyYQyDMFXZp/VfddukhKJcXpKKZFTHNWt3Mp6YWbnanm+lqJ9y3 tC3wuls/dCM8o9/476jxo6p09yiuNEKdoz4HV1Zxtv7Fuynlvz3EYwTBOBfNKFikBP175t CMKhMk/JECtMapmAVoFtLgVc+i1tbjI90oqrK7dVic/nmkLNHq68aLRmoU1niSDSBMRkxD I59g53dpUkvoNjmIU/rdblUNN2mImCkKexrXdTDmOpcNjI2CmbpU9uU5JxVfkQ== Date: Mon, 9 May 2022 15:08:15 +0200 From: Miquel Raynal To: Tom Rini Cc: Sean Nyekjaer , Joao Marcos Costa , Thomas Petazzoni , u-boot@lists.denx.de, Sean Nyekjaer Subject: Re: [PATCH] fs/squashfs: use do_div function for math Message-ID: <20220509150815.43d7543c@xps13> In-Reply-To: <20220505131500.GF3580959@bill-the-cat> References: <20220505092637.1856223-1-sean@geanix.com> <20220505131500.GF3580959@bill-the-cat> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Hello, trini@konsulko.com wrote on Thu, 5 May 2022 09:15:00 -0400: > On Thu, May 05, 2022 at 11:26:37AM +0200, Sean Nyekjaer wrote: >=20 > > From: Sean Nyekjaer > >=20 > > 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 `__udivm= oddi4' > >=20 > > Signed-off-by: Sean Nyekjaer > > --- > > fs/squashfs/sqfs.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > >=20 > > 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 @@ > > */ > > =20 > > #include > > +#include > > #include > > #include > > #include > > @@ -1440,7 +1441,7 @@ int sqfs_read(const char *filename, void *buf, lo= ff_t offset, loff_t len, > > } > > =20 > > for (j =3D 0; j < datablk_count; j++) { > > - start =3D data_offset / ctxt.cur_dev->blksz; > > + start =3D do_div(data_offset, ctxt.cur_dev->blksz); > > table_size =3D SQFS_BLOCK_SIZE(finfo.blk_sizes[j]); > > table_offset =3D data_offset - (start * ctxt.cur_dev->blksz); > > n_blks =3D DIV_ROUND_UP(table_size + table_offset, > > @@ -1516,7 +1517,7 @@ int sqfs_read(const char *filename, void *buf, lo= ff_t offset, loff_t len, > > goto out; > > } > > =20 > > - start =3D frag_entry.start / ctxt.cur_dev->blksz; > > + start =3D do_div(frag_entry.start, ctxt.cur_dev->blksz); > > table_size =3D SQFS_BLOCK_SIZE(frag_entry.size); > > table_offset =3D frag_entry.start - (start * ctxt.cur_dev->blksz); > > n_blks =3D DIV_ROUND_UP(table_size + table_offset, ctxt.cur_dev->blks= z); =20 >=20 > Adding maintainers... I guess that's a correct fix, so Reviewed-by: Miquel Raynal Thanks, Miqu=C3=A8l