|
|
9ae3a8 |
From 64b612d6551f21f7c3e34fa522b5b9c13f2b4ed8 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <64b612d6551f21f7c3e34fa522b5b9c13f2b4ed8.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:52:59 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 23/46] rdma: don't use negative index to array
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-24-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55707
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 23/42] rdma: don't use negative index to array
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 44b5949491a47043c4f7c4ff09f0191f82919a82
|
|
|
9ae3a8 |
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Date: Sat Aug 3 22:54:51 2013 -0400
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: don't use negative index to array
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Message-id: 1375584894-9917-5-git-send-email-mrhines@linux.vnet.ibm.com
|
|
|
9ae3a8 |
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 27 +++++++++++++++------------
|
|
|
9ae3a8 |
1 files changed, 15 insertions(+), 12 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 27 +++++++++++++++------------
|
|
|
9ae3a8 |
1 file changed, 15 insertions(+), 12 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/migration-rdma.c b/migration-rdma.c
|
|
|
9ae3a8 |
index c958e5f..7266803 100644
|
|
|
9ae3a8 |
--- a/migration-rdma.c
|
|
|
9ae3a8 |
+++ b/migration-rdma.c
|
|
|
9ae3a8 |
@@ -1933,10 +1933,21 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)
|
|
|
9ae3a8 |
static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
|
|
|
9ae3a8 |
uint64_t offset, uint64_t len)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- RDMALocalBlock *block =
|
|
|
9ae3a8 |
- &(rdma->local_ram_blocks.block[rdma->current_index]);
|
|
|
9ae3a8 |
- uint8_t *host_addr = block->local_host_addr + (offset - block->offset);
|
|
|
9ae3a8 |
- uint8_t *chunk_end = ram_chunk_end(block, rdma->current_chunk);
|
|
|
9ae3a8 |
+ RDMALocalBlock *block;
|
|
|
9ae3a8 |
+ uint8_t *host_addr;
|
|
|
9ae3a8 |
+ uint8_t *chunk_end;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (rdma->current_index < 0) {
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (rdma->current_chunk < 0) {
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ block = &(rdma->local_ram_blocks.block[rdma->current_index]);
|
|
|
9ae3a8 |
+ host_addr = block->local_host_addr + (offset - block->offset);
|
|
|
9ae3a8 |
+ chunk_end = ram_chunk_end(block, rdma->current_chunk);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (rdma->current_length == 0) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
@@ -1949,10 +1960,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (rdma->current_index < 0) {
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
if (offset < block->offset) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1961,10 +1968,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (rdma->current_chunk < 0) {
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
if ((host_addr + len) > chunk_end) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|