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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3FUtGceVWK530E-iOWqh=p=Q-KKZCkNCeXh2UhFc3m9A@mail.gmail.com>
Date:   Wed, 6 Mar 2019 11:26:49 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Anshuman Khandual <anshuman.khandual@....com>
Cc:     Jérôme Glisse <jglisse@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Ralph Campbell <rcampbell@...dia.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        John Hubbard <jhubbard@...dia.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/hmm: fix unused variable warnings

On Tue, Mar 5, 2019 at 1:18 PM Anshuman Khandual
<anshuman.khandual@....com> wrote:
> On 03/05/2019 01:30 AM, Arnd Bergmann wrote:
> > When CONFIG_HUGETLB_PAGE is disabled, the only use of the variable 'h'
> > is compiled out, and the compiler thinks it is unnecessary:
> >
> > mm/hmm.c: In function 'hmm_range_snapshot':
> > mm/hmm.c:1015:19: error: unused variable 'h' [-Werror=unused-variable]
> >     struct hstate *h = hstate_vma(vma);
>
> After doing some Kconfig hacks like (ARCH_WANT_GENERAL_HUGETLB = n) on an
> X86 system I got (HUGETLB_PAGE = n and HMM = y) config. But was unable to
> hit the build error. Helper is_vm_hugetlb_page() seems to always return
> false when HUGETLB_PAGE = n. Would not the compiler remove the entire code
> block including the declaration for 'h' ?
>
> #ifdef CONFIG_HUGETLB_PAGE
> #include <linux/mm.h>
> static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
> {
>         return !!(vma->vm_flags & VM_HUGETLB);
> }
> #else
> static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
> {
>         return false;
> }
> #endif

The is_vm_hugetlb_page() check is unrelated to the warning here,
the problem is that huge_page_shift() is defined as

#define huge_page_shift(h) PAGE_SHIFT

when CONFIG_HUGETLB_PAGE is disabled, so after preprocessing,
the only reference to the variable is removed.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ