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, 1 Dec 2023 14:24:06 -0800
From:   Sean Christopherson <seanjc@...gle.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Yu Zhang <yu.c.zhang@...ux.intel.com>,
        Isaku Yamahata <isaku.yamahata@...el.com>,
        Chao Peng <chao.p.peng@...ux.intel.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: guest-memfd: fix unused-function warning

On Wed, Nov 29, 2023, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> With migration disabled, one function becomes unused:
> 
> virt/kvm/guest_memfd.c:262:12: error: 'kvm_gmem_migrate_folio' defined but not used [-Werror=unused-function]
>   262 | static int kvm_gmem_migrate_folio(struct address_space *mapping,
>       |            ^~~~~~~~~~~~~~~~~~~~~~
> 
> Replace the #ifdef around the reference with a corresponding PTR_IF() check
> that lets the compiler know how it is otherwise used.
> 
> Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  virt/kvm/guest_memfd.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index 16d58806e913..1a0355b95379 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -301,9 +301,8 @@ static int kvm_gmem_error_folio(struct address_space *mapping,
>  
>  static const struct address_space_operations kvm_gmem_aops = {
>  	.dirty_folio = noop_dirty_folio,
> -#ifdef CONFIG_MIGRATION
> -	.migrate_folio	= kvm_gmem_migrate_folio,
> -#endif
> +	.migrate_folio = PTR_IF(IS_ENABLED(CONFIG_MIGRATION),
> +				kvm_gmem_migrate_folio),

I'd much prefer to just delete the #ifdef, e.g. so that we don't somehow end up
running fallback_migrate_folio().  I have no clue why I wrapped the hook with
CONFIG_MIGRATION.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ