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] [day] [month] [year] [list]
Date:   Fri, 8 Nov 2019 16:50:44 +0800
From:   Zong Li <zong.li@...ive.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...ive.com>,
        Anup Patel <Anup.Patel@....com>
Subject: Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE

On Fri, Nov 8, 2019 at 3:25 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> >       uintptr_t map_size = PAGE_SIZE;
> >
> > -     /* Upgrade to PMD/PGDIR mappings whenever possible */
> > -     if (!(base & (PTE_PARENT_SIZE - 1)) &&
> > -         !(size & (PTE_PARENT_SIZE - 1)))
> > -             map_size = PTE_PARENT_SIZE;
> > +     /* Upgrade to PMD_SIZE mappings whenever possible */
> > +     if (!(base & (PMD_SIZE - 1)) &&
> > +         !(size & (PMD_SIZE - 1)))
> > +             map_size = PMD_SIZE;
>
> The check easily fits onto a single line now.  Also the map_size
> variable is rather pointless.  Why not:
>
>         if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
>                 return PAGE_SIZE;
>         return PMD_SIZE;

Yes, Use positive representation is more clear to me. Change it in next version.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ