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: <0d23822d-1510-d615-c3bf-200b6636b766@redhat.com>
Date:   Mon, 26 Apr 2021 11:28:29 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Zhenzhong Duan <zhenzhong.duan@...el.com>,
        linux-kernel@...r.kernel.org
Cc:     linux-kselftest@...r.kernel.org, kvm@...r.kernel.org,
        shuah@...nel.org
Subject: Re: [PATCH] selftests: kvm: Fix the check of return value

On 26/04/21 21:31, Zhenzhong Duan wrote:
> In vm_vcpu_rm() and kvm_vm_release(), a stale return value is checked in
> TEST_ASSERT macro.
> 
> Fix it by assigning variable ret with correct return value.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@...el.com>
> ---
>   tools/testing/selftests/kvm/lib/kvm_util.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
> index b8849a1aca79..53d3a7eb0d47 100644
> --- a/tools/testing/selftests/kvm/lib/kvm_util.c
> +++ b/tools/testing/selftests/kvm/lib/kvm_util.c
> @@ -514,7 +514,7 @@ static void vm_vcpu_rm(struct kvm_vm *vm, struct vcpu *vcpu)
>   	ret = munmap(vcpu->state, vcpu_mmap_sz());
>   	TEST_ASSERT(ret == 0, "munmap of VCPU fd failed, rc: %i "
>   		"errno: %i", ret, errno);
> -	close(vcpu->fd);
> +	ret = close(vcpu->fd);
>   	TEST_ASSERT(ret == 0, "Close of VCPU fd failed, rc: %i "
>   		"errno: %i", ret, errno);
>   
> @@ -534,7 +534,7 @@ void kvm_vm_release(struct kvm_vm *vmp)
>   	TEST_ASSERT(ret == 0, "Close of vm fd failed,\n"
>   		"  vmp->fd: %i rc: %i errno: %i", vmp->fd, ret, errno);
>   
> -	close(vmp->kvm_fd);
> +	ret = close(vmp->kvm_fd);
>   	TEST_ASSERT(ret == 0, "Close of /dev/kvm fd failed,\n"
>   		"  vmp->kvm_fd: %i rc: %i errno: %i", vmp->kvm_fd, ret, errno);
>   }
> 

Queued, thanks.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ