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]
Date:   Tue, 2 Jul 2019 13:54:18 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     linux-mm@...ck.org, Stephen Rothwell <sfr@...b.auug.org.au>,
        Robin Murphy <robin.murphy@....com>,
        linux-kernel@...r.kernel.org,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH -next] mm: Mark undo_dev_pagemap as __maybe_unused

On Tue,  2 Jul 2019 06:02:03 -0700 Guenter Roeck <linux@...ck-us.net> wrote:

> Several mips builds generate the following build warning.
> 
> mm/gup.c:1788:13: warning: 'undo_dev_pagemap' defined but not used
> 
> The function is declared unconditionally but only called from behind
> various ifdefs. Mark it __maybe_unused.
> 
> ...
>
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1785,7 +1785,8 @@ static inline pte_t gup_get_pte(pte_t *ptep)
>  }
>  #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */
>  
> -static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages)
> +static void __maybe_unused undo_dev_pagemap(int *nr, int nr_start,
> +					    struct page **pages)
>  {
>  	while ((*nr) - nr_start) {
>  		struct page *page = pages[--(*nr)];

It's not our preferred way of doing it but yes, it would be a bit of a
mess and a bit of a maintenance burden to get the ifdefs correct.

And really, __maybe_unused isn't a bad way at all - it ensures that the
function always gets build-tested and the compiler will remove it so we
don't have to play the chase-the-ifdefs game.

Powered by blists - more mailing lists