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: <2b9f6a42-825f-1141-06db-932732a0cf99@huawei.com>
Date:   Sun, 14 Nov 2021 15:11:53 +0800
From:   Zenghui Yu <yuzenghui@...wei.com>
To:     Jason Wang <wangborong@...rlc.com>
CC:     <catalin.marinas@....com>, <maz@...nel.org>, <will@...nel.org>,
        <james.morse@....com>, <alexandru.elisei@....com>,
        <suzuki.poulose@....com>, <linux-arm-kernel@...ts.infradead.org>,
        <kvmarm@...ts.cs.columbia.edu>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KVM: arm64: remove unneeded comparison

Hi,

On 2021/11/14 14:40, Jason Wang wrote:
> The unsigned expression compared with zero `target < 0' is
> unneeded and its result is always false. we can also check the
> target's value returned from `kvm_target_cpu' is one of the
> KVM_* macros, and these macros are defined greater than or equal
> to 0.
> Therefore, the comparison code block:
>     if (target < 0)
>         return -ENODEV;
> is unneeded. We can safely remove it.
> 
> Signed-off-by: Jason Wang <wangborong@...rlc.com>
> ---
>  arch/arm64/kvm/guest.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 5ce26bedf23c..1605cb71dd52 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -873,9 +873,6 @@ int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
>  {
>  	u32 target = kvm_target_cpu();
>  
> -	if (target < 0)
> -		return -ENODEV;
> -
>  	memset(init, 0, sizeof(*init));
>  
>  	/*

FYI there's already a similar change in mainline now:

https://git.kernel.org/torvalds/c/08e873cb70f3

Thanks,
Zenghui

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ