public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Tom Rini <trini@konsulko.com>
Cc: Sean Nyekjaer <sean@geanix.com>,
	Joao Marcos Costa <joaomarcos.costa@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	u-boot@lists.denx.de,
	Sean Nyekjaer <sean.nyekjaer.ext@siemensgamesa.com>
Subject: Re: [PATCH] fs/squashfs: use do_div function for math
Date: Mon, 9 May 2022 15:08:15 +0200	[thread overview]
Message-ID: <20220509150815.43d7543c@xps13> (raw)
In-Reply-To: <20220505131500.GF3580959@bill-the-cat>

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:
> 
> > From: Sean Nyekjaer <sean.nyekjaer.ext@siemensgamesa.com>
> > 
> > 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>
> > ---
> >  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 <asm/unaligned.h>
> > +#include <div64.h>
> >  #include <errno.h>
> >  #include <fs.h>
> >  #include <linux/types.h>
> > @@ -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);  
> 
> Adding maintainers...

I guess that's a correct fix, so

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

  reply	other threads:[~2022-05-09 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  9:26 [PATCH] fs/squashfs: use do_div function for math Sean Nyekjaer
2022-05-05 13:15 ` Tom Rini
2022-05-09 13:08   ` Miquel Raynal [this message]
2022-05-12 10:19     ` Pali Rohár
2022-05-12 10:24       ` Pali Rohár
2022-05-12 18:02         ` Sean Nyekjaer
2022-05-12 18:23           ` Tom Rini
2022-05-12 18:41           ` Pali Rohár
2022-05-12 18:47             ` Sean Nyekjaer
2022-05-12 18:52           ` Michael Nazzareno Trimarchi
2022-05-12 18:55             ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220509150815.43d7543c@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=joaomarcos.costa@bootlin.com \
    --cc=sean.nyekjaer.ext@siemensgamesa.com \
    --cc=sean@geanix.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox