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: <e7b65d0a-8c68-10b6-5178-decfcea54e04@redhat.com>
Date:   Mon, 21 Oct 2019 10:59:08 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Miaohe Lin <linmiaohe@...wei.com>, rkrcmar@...hat.com,
        sean.j.christopherson@...el.com, vkuznets@...hat.com,
        wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com
Cc:     x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KVM: remove redundant code in kvm_arch_vm_ioctl

On 21/10/19 10:52, Miaohe Lin wrote:
> If we reach here with r = 0, we will reassign r = 0
> unnecesarry, then do the label set_irqchip_out work.
> If we reach here with r != 0, then we will do the label
> work directly. So this if statement and r = 0 assignment
> is redundant. We remove them and therefore we can get rid
> of odd set_irqchip_out lable further pointed out by tglx.

While Thomas's suggestion certainly makes sense, I prefer to keep the
get and set cases similar to each other, so I queued your v1 patch.
Thanks for making the KVM code cleaner!

Paolo

> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>  arch/x86/kvm/x86.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 661e2bf38526..cd4ca8c2f7de 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4913,13 +4913,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
>  		}
>  
>  		r = -ENXIO;
> -		if (!irqchip_kernel(kvm))
> -			goto set_irqchip_out;
> -		r = kvm_vm_ioctl_set_irqchip(kvm, chip);
> -		if (r)
> -			goto set_irqchip_out;
> -		r = 0;
> -	set_irqchip_out:
> +		if (irqchip_kernel(kvm))
> +			r = kvm_vm_ioctl_set_irqchip(kvm, chip);
>  		kfree(chip);
>  		break;
>  	}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ