|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH] accel/kvm: ensure ret always set |
Date: | Thu, 3 Oct 2019 12:18:29 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 10/3/19 11:22 AM, Stefano Garzarella wrote:
On Wed, Oct 02, 2019 at 01:08:40PM +0200, Paolo Bonzini wrote:On 02/10/19 12:22, Alex Bennée wrote:Some of the cross compilers rightly complain there are cases where ret may not be set. 0 seems to be the reasonable default unless particular slot explicitly returns -1.Even Coverity reported it (CID 1405857).
And GCC ;) /home/phil/source/qemu/accel/kvm/kvm-all.c: In function ‘kvm_log_clear’:/home/phil/source/qemu/accel/kvm/kvm-all.c:1121:8: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (r < 0) { ^ cc1: all warnings being treated as errorsmake[1]: *** [/home/phil/source/qemu/rules.mak:69: accel/kvm/kvm-all.o] Error 1
Fixes: 4222147dfb7
Signed-off-by: Alex Bennée <address@hidden> --- accel/kvm/kvm-all.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index aabe097c41..d2d96d73e8 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -712,11 +712,11 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml, KVMState *s = kvm_state; uint64_t start, size, offset, count; KVMSlot *mem; - int ret, i; + int ret = 0, i;if (!s->manual_dirty_log_protect) {/* No need to do explicit clear */ - return 0; + return ret; }start = section->offset_within_address_space;@@ -724,7 +724,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml,if (!size) {/* Nothing more we can do... */ - return 0; + return ret; }kvm_slots_lock(kml);Queued, thanks. Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |