summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/mem_detect.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-06-19 09:16:54 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-06-19 15:36:16 +0200
commit35b03aec919c952e67b0b093638e0d79b468f9bc (patch)
tree34b38d974ccb0b3d267d338041397e8eecc720d9 /arch/s390/mm/mem_detect.c
parent4026099a3118a1e038c48f3f85203a674938025b (diff)
downloadop-kernel-dev-35b03aec919c952e67b0b093638e0d79b468f9bc.zip
op-kernel-dev-35b03aec919c952e67b0b093638e0d79b468f9bc.tar.gz
s390/mem_detect: fix memory hole handling
With git commit 996b4a7d "s390/mem_detect: remove artificial kdump memory types" the memory detection code got simplified. As a side effect the array that describes memory chunks may now contain empty (zeroed) entries. All call sites can handle this except for drivers/s390/char/zcore.c::zcore_memmap_open which has a really odd user space interface. The easiest fix is to change the memory hole handling code, so that no empty entries exist before the last valid entry is reached. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/mem_detect.c')
-rw-r--r--arch/s390/mm/mem_detect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c
index 3cbd3b8..cca3882 100644
--- a/arch/s390/mm/mem_detect.c
+++ b/arch/s390/mm/mem_detect.c
@@ -123,7 +123,8 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
continue;
} else if ((addr <= chunk->addr) &&
(addr + size >= chunk->addr + chunk->size)) {
- memset(chunk, 0 , sizeof(*chunk));
+ memmove(chunk, chunk + 1, (MEMORY_CHUNKS-i-1) * sizeof(*chunk));
+ memset(&mem_chunk[MEMORY_CHUNKS-1], 0, sizeof(*chunk));
} else if (addr + size < chunk->addr + chunk->size) {
chunk->size = chunk->addr + chunk->size - addr - size;
chunk->addr = addr + size;
OpenPOWER on IntegriCloud