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: <CAFH1YnN01PtCBm_92m3CPRhsiS2Bzis8q-vOJ5q+_LUq8ZoZqg@mail.gmail.com>
Date:   Thu, 5 Mar 2020 12:03:26 +0800
From:   Zhenzhong Duan <zhenzhong.duan@...il.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Borislav Petkov <bp@...e.de>, "H. Peter Anvin" <hpa@...or.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH 2/2] x86/boot/KASLR: Fix unused variable warning

On Wed, Mar 4, 2020 at 6:56 AM Dave Hansen <dave.hansen@...el.com> wrote:
>
> On 3/2/20 10:52 PM, Zhenzhong Duan wrote:
> > Local variable 'i' is referenced only when CONFIG_MEMORY_HOTREMOVE and
> > CONFIG_ACPI are defined, but definition of variable 'i' is out of guard.
> > If any of the two macros is undefined, below warning triggers during
> > build, fix it by moving 'i' in the guard.
> >
> > arch/x86/boot/compressed/kaslr.c:698:6: warning: unused variable ā€˜iā€™ [-Wunused-variable]
> ...
> > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> > index d7408af55738..62bc46684581 100644
> > --- a/arch/x86/boot/compressed/kaslr.c
> > +++ b/arch/x86/boot/compressed/kaslr.c
> > @@ -695,7 +695,6 @@ static bool process_mem_region(struct mem_vector *region,
> >                              unsigned long long minimum,
> >                              unsigned long long image_size)
> >  {
> > -     int i;
> >       /*
> >        * If no immovable memory found, or MEMORY_HOTREMOVE disabled,
> >        * use @region directly.
> > @@ -711,6 +710,7 @@ static bool process_mem_region(struct mem_vector *region,
> >       }
> >
> >  #if defined(CONFIG_MEMORY_HOTREMOVE) && defined(CONFIG_ACPI)
> > +     int i;
>
> Won't this just result in a different warning since it now it will
> declare 'i' in the middle of the function once CONFIG_MEMORY_HOTREMOVE
> and ACPI are enabled?

I didn't see a different warning with both configs enabled, because
-std=gnu89 isn't
enforced in arch/x86/boot/compressed but it does in other part of kernel.
C99 and above allows declaration in middule of the function.

Zhenzhong

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ