qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kvm_set_user_memory_region() doesn't check ioctl return value


From: Paolo Bonzini
Subject: Re: kvm_set_user_memory_region() doesn't check ioctl return value
Date: Tue, 7 Jan 2020 16:00:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 07/01/20 15:52, Peter Maydell wrote:
> Coverity has just pointed out (CID 1412229) that the function
> kvm_set_user_memory_region() in accel/kvm/kvm-all.c calls
> kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, ...) twice, but
> it only checks the ioctl return value for failure in the
> second case. Shouldn't it be checking both calls?

The first ioctl is basically setting up things so that the second can
succeed.  My understanding of the code (and the comment above the first
call especially) is that if the first ioctl fails, it will cause the
second to fail as well.

However, it would indeed by cleaner to check both.

Paolo

> (This code seems to have been in place for years so I guess
> Coverity has only just decided that kvm_vm_ioctl() passes its
> 'needs return value checking' heuristic...)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]