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]
Message-ID: <20170502074047.GB2579@x1>
Date:   Tue, 2 May 2017 15:40:47 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     Yinghai Lu <yinghai@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        the arch/x86 maintainers <x86@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Thomas Garnier <thgarnie@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Yasuaki Ishimatsu <yasu.isimatu@...il.com>,
        Jinbum Park <jinb.park7@...il.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Young <dyoung@...hat.com>
Subject: Re: [PATCH] x86/mm: Fix incorrect for loop count calculation in
 sync_global_pgds

On 05/02/17 at 09:24am, Ingo Molnar wrote:
> 
> * Baoquan He <bhe@...hat.com> wrote:
> 
> > On 05/01/17 at 03:37pm, Yinghai Lu wrote:
> > > On Mon, May 1, 2017 at 4:41 AM, Baoquan He <bhe@...hat.com> wrote:
> > > >  arch/x86/mm/init_64.c | 6 ++++--
> > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > > > index 15173d3..dbf4f00 100644
> > > > --- a/arch/x86/mm/init_64.c
> > > > +++ b/arch/x86/mm/init_64.c
> > > > @@ -94,12 +94,14 @@ __setup("noexec32=", nonx32_setup);
> > > >   */
> > > >  void sync_global_pgds(unsigned long start, unsigned long end)
> > > >  {
> > > > -       unsigned long address;
> > > > +       unsigned long address, address_next;
> > > >
> > > > -       for (address = start; address <= end; address += PGDIR_SIZE) {
> > > > +       for (address = start; address <= end; address = address_next) {
> > > >                 const pgd_t *pgd_ref = pgd_offset_k(address);
> > > >                 struct page *page;
> > > >
> > > > +               address_next = (address & PGDIR_MASK) + PGDIR_SIZE;
> > > > +
> > > >                 if (pgd_none(*pgd_ref))
> > > >                         continue;
> > > >
> > > 
> > > This one is better than V2.
> > > 
> > > It would better if could rename address to addr as Ingo suggested.
> > 
> > Thanks for your checking and suggestion, Yinghai.
> > 
> > Both v1 and v2 are fine to me. As you said, code in v1 is easily
> > understood, while v2 code is more compact, less line. The line of v1 is
> > not more than 80. Maybe Ingo can help choose one which he likes better.
> 
> Let's do the variant I suggested - that makes the loop self-contained ('continue' 
> would work as-is, etc.) and makes the code all around more readable.

Sure, let me change as you said, will post after testing passed.

Thanks a lot!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ