From ebf037d8c8f8dca16907cecf9e5a2d8b316f5ba6 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Mon, 13 Jul 2015 13:42:06 +0200 Subject: [PATCH 26/58] RDMA: Fix error exits (for 2.4) Message-id: <1436794926-1598-18-git-send-email-dgilbert@redhat.com> Patchwork-id: 66985 O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 17/17] RDMA: Fix error exits (for 2.4) Bugzilla: 1210715 RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Laszlo Ersek RH-Acked-by: Juan Quintela From: "Dr. David Alan Gilbert" 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 Signed-off-by: Miroslav Rezanina --- migration/rdma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 9838a6d..78eb4b0 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2996,7 +2996,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]); @@ -3091,7 +3091,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) { @@ -3101,7 +3101,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)); @@ -3117,7 +3117,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); -- 1.8.3.1