public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] disk: part_dos: Fix part_test_dos() regression
Date: Tue, 3 Oct 2017 12:10:59 -0400	[thread overview]
Message-ID: <20171003161059.GA22973@bill-the-cat> (raw)
In-Reply-To: <CAF6AEGsRyTkV8AsjvvLseCyS4=+nWJ8NcS2PPaHNvxAc9npHZw@mail.gmail.com>

On Tue, Oct 03, 2017 at 08:44:31AM -0400, Rob Clark wrote:
> On Tue, Oct 3, 2017 at 7:04 AM, Fabio Estevam <festevam@gmail.com> wrote:
> > On Tue, Oct 3, 2017 at 7:57 AM, Rob Clark <robdclark@gmail.com> wrote:
> >
> >> btw, if I had to take a guess, I'd say that perhaps blksz is smaller
> >> than 'legacy_mbr', so maybe rather than allocating blksize, it should
> >> be DIV_ROUND_UP(sizeof(legacy_mbr), dev_desc->blksz).. or I guess that
> >> could be simplified to not use division if blksz is a power of two
> >
> > Yes, it does seem to be size related as we are size constraint in SPL.
> >
> > Just tried your suggestion:
> >
> > --- a/disk/part_dos.c
> > +++ b/disk/part_dos.c
> > @@ -89,7 +89,9 @@ static int test_block_type(unsigned char *buffer)
> >
> >  static int part_test_dos(struct blk_desc *dev_desc)
> >  {
> > -       ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz);
> > +       ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr,
> > +                                DIV_ROUND_UP(sizeof(legacy_mbr),
> > +                                dev_desc->blksz));
> >
> >         if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1)
> >                 return -1;
> >
> > and it does work for me :-)
> 
> Ok, I guess if blksz can actually be less than the mbr, we probably
> also need a similar fix in is_gpt_valid() (and also to pass the
> correct # of blks to blk_dread())..  I'll make a patch in a few..

If you want to re-work / include my changes in
https://patchwork.ozlabs.org/patch/820884/ in v2 of
https://patchwork.ozlabs.org/patch/820920/ please feel free (and make
sure we don't have / introduce more similar ones), thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171003/8f9f264b/attachment.sig>

      reply	other threads:[~2017-10-03 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03  1:50 [U-Boot] [RFC] disk: part_dos: Fix part_test_dos() regression Fabio Estevam
2017-10-03 10:47 ` Rob Clark
2017-10-03 10:57   ` Rob Clark
2017-10-03 11:04     ` Fabio Estevam
2017-10-03 12:44       ` Rob Clark
2017-10-03 16:10         ` Tom Rini [this message]

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=20171003161059.GA22973@bill-the-cat \
    --to=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