lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Apr 2019 21:44:19 +0700
From:   Phong Tran <tranmanphong@...il.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     robh+dt@...nel.org, frowand.list@...il.com,
        Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
        natechancellor@...il.com, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        clang-built-linux@...glegroups.com
Subject: Re: [PATCH] of: replace be32_to_cpu to be32_to_cpup

On Tue, Apr 30, 2019 at 8:32 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Tue, Apr 30, 2019 at 04:00:44PM +0700, Phong Tran wrote:
> >
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index e240992e5cb6..1c35fc8f19b0 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -235,7 +235,7 @@ static inline u64 of_read_number(const __be32 *cell, int size)
> >  {
> >       u64 r = 0;
> >       while (size--)
> > -             r = (r << 32) | be32_to_cpu(*(cell++));
> > +             r = (r << 32) | be32_to_cpup(cell++);
> >       return r;
>
> This whole function looks odd.  It could simply be replaced with
> calls to get_unaligned_be64 / get_unaligned_be32.  Given that we have a
> lot of callers we can't easily do that, but at least we could try
> something like
>
It's risky. there are many callers of of_read_number().
There is suggestion from David
(https://lore.kernel.org/lkml/46b3e8edf27e4c8f98697f9e7f2117d6@AcuMS.aculab.com/)
only changing the loop.

> static inline u64 of_read_number(const __be32 *cell, int size)
> {
>         WARN_ON_ONCE(size < 1);
>         WARN_ON_ONCE(size > 2);
>
>         if (size == 1)
>                 return get_unaligned_be32(cell);
>         return get_unaligned_be64(cell);
> }

Thank you for your support.

Phong.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ