* [Qemu-devel] [PATCH] RDMA: Fix error exits (for 2.4)
@ 2015-07-10 19:08 Dr. David Alan Gilbert (git)
2015-07-10 21:10 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2015-07-10 19:08 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, pbonzini, mrhines, quintela
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
The error checks I added used 'break' after the error, but I'm
in a switch inside the while loop, so they need to be 'goto out'.
Spotted by coverity; entries 1311368 and 1311369
Fixes: afcddefd
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/rdma.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index f106b2a..74876fd 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2997,7 +2997,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
(unsigned int)comp->block_idx,
rdma->local_ram_blocks.nb_blocks);
ret = -EIO;
- break;
+ goto out;
}
block = &(rdma->local_ram_blocks.block[comp->block_idx]);
@@ -3092,7 +3092,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
(unsigned int)reg->current_index,
rdma->local_ram_blocks.nb_blocks);
ret = -ENOENT;
- break;
+ goto out;
}
block = &(rdma->local_ram_blocks.block[reg->current_index]);
if (block->is_ram_block) {
@@ -3102,7 +3102,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
block->block_name, block->offset,
reg->key.current_addr);
ret = -ERANGE;
- break;
+ goto out;
}
host_addr = (block->local_host_addr +
(reg->key.current_addr - block->offset));
@@ -3118,7 +3118,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
" chunk: %" PRIx64,
block->block_name, reg->key.chunk);
ret = -ERANGE;
- break;
+ goto out;
}
}
chunk_start = ram_chunk_start(block, chunk);
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] RDMA: Fix error exits (for 2.4)
2015-07-10 19:08 [Qemu-devel] [PATCH] RDMA: Fix error exits (for 2.4) Dr. David Alan Gilbert (git)
@ 2015-07-10 21:10 ` Paolo Bonzini
2015-07-13 8:03 ` Juan Quintela
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-07-10 21:10 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), qemu-devel; +Cc: amit.shah, mrhines, quintela
Juan, okay for me to pick it up together with a bunch of other Coverity
fixes?
Paolo
On 10/07/2015 21:08, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The error checks I added used 'break' after the error, but I'm
> in a switch inside the while loop, so they need to be 'goto out'.
>
> Spotted by coverity; entries 1311368 and 1311369
>
> Fixes: afcddefd
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> migration/rdma.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index f106b2a..74876fd 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -2997,7 +2997,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
> (unsigned int)comp->block_idx,
> rdma->local_ram_blocks.nb_blocks);
> ret = -EIO;
> - break;
> + goto out;
> }
> block = &(rdma->local_ram_blocks.block[comp->block_idx]);
>
> @@ -3092,7 +3092,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
> (unsigned int)reg->current_index,
> rdma->local_ram_blocks.nb_blocks);
> ret = -ENOENT;
> - break;
> + goto out;
> }
> block = &(rdma->local_ram_blocks.block[reg->current_index]);
> if (block->is_ram_block) {
> @@ -3102,7 +3102,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
> block->block_name, block->offset,
> reg->key.current_addr);
> ret = -ERANGE;
> - break;
> + goto out;
> }
> host_addr = (block->local_host_addr +
> (reg->key.current_addr - block->offset));
> @@ -3118,7 +3118,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
> " chunk: %" PRIx64,
> block->block_name, reg->key.chunk);
> ret = -ERANGE;
> - break;
> + goto out;
> }
> }
> chunk_start = ram_chunk_start(block, chunk);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] RDMA: Fix error exits (for 2.4)
2015-07-10 21:10 ` Paolo Bonzini
@ 2015-07-13 8:03 ` Juan Quintela
0 siblings, 0 replies; 3+ messages in thread
From: Juan Quintela @ 2015-07-13 8:03 UTC (permalink / raw)
To: Paolo Bonzini
Cc: amit.shah, mrhines, Dr. David Alan Gilbert (git), qemu-devel
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Juan, okay for me to pick it up together with a bunch of other Coverity
> fixes?
Yeap.
Thanks.
>
> Paolo
>
> On 10/07/2015 21:08, Dr. David Alan Gilbert (git) wrote:
>> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>>
>> The error checks I added used 'break' after the error, but I'm
>> in a switch inside the while loop, so they need to be 'goto out'.
>>
>> Spotted by coverity; entries 1311368 and 1311369
>>
>> Fixes: afcddefd
You mangle the commit by hand? Only letters? Next time you will get
words, right? O:-)
>>
>> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>> migration/rdma.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/migration/rdma.c b/migration/rdma.c
>> index f106b2a..74876fd 100644
>> --- a/migration/rdma.c
>> +++ b/migration/rdma.c
>> @@ -2997,7 +2997,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
>> (unsigned int)comp->block_idx,
>> rdma->local_ram_blocks.nb_blocks);
>> ret = -EIO;
>> - break;
>> + goto out;
>> }
>> block = &(rdma->local_ram_blocks.block[comp->block_idx]);
>>
>> @@ -3092,7 +3092,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
>> (unsigned int)reg->current_index,
>> rdma->local_ram_blocks.nb_blocks);
>> ret = -ENOENT;
>> - break;
>> + goto out;
>> }
>> block = &(rdma->local_ram_blocks.block[reg->current_index]);
>> if (block->is_ram_block) {
>> @@ -3102,7 +3102,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
>> block->block_name, block->offset,
>> reg->key.current_addr);
>> ret = -ERANGE;
>> - break;
>> + goto out;
>> }
>> host_addr = (block->local_host_addr +
>> (reg->key.current_addr - block->offset));
>> @@ -3118,7 +3118,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
>> " chunk: %" PRIx64,
>> block->block_name, reg->key.chunk);
>> ret = -ERANGE;
>> - break;
>> + goto out;
>> }
>> }
>> chunk_start = ram_chunk_start(block, chunk);
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-13 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-10 19:08 [Qemu-devel] [PATCH] RDMA: Fix error exits (for 2.4) Dr. David Alan Gilbert (git)
2015-07-10 21:10 ` Paolo Bonzini
2015-07-13 8:03 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).