|
|
4a2fec |
From 4fd31afb27446d33e659cb279691aa94270e6bfb Mon Sep 17 00:00:00 2001
|
|
|
4a2fec |
From: Cornelia Huck <cohuck@redhat.com>
|
|
|
4a2fec |
Date: Wed, 13 Sep 2017 16:20:35 +0200
|
|
|
4a2fec |
Subject: dump: do not dump non-existent guest memory
|
|
|
4a2fec |
|
|
|
4a2fec |
It does not really make sense to dump memory that is not there.
|
|
|
4a2fec |
|
|
|
4a2fec |
Moreover, that fixes a segmentation fault when calling dump-guest-memory
|
|
|
4a2fec |
with no filter for a machine with no memory defined.
|
|
|
4a2fec |
|
|
|
4a2fec |
New behaviour is:
|
|
|
4a2fec |
|
|
|
4a2fec |
(qemu) dump-guest-memory /dev/null
|
|
|
4a2fec |
dump: no guest memory to dump
|
|
|
4a2fec |
(qemu) dump-guest-memory /dev/null 0 4096
|
|
|
4a2fec |
dump: no guest memory to dump
|
|
|
4a2fec |
|
|
|
4a2fec |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
4a2fec |
Tested-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
4a2fec |
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
4a2fec |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
4a2fec |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
4a2fec |
Message-Id: <20170913142036.2469-4-lvivier@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
4a2fec |
(cherry picked from commit d1e6994abcd12c7f54aa73ff848fb6215c783898)
|
|
|
4a2fec |
---
|
|
|
4a2fec |
dump.c | 6 ++++++
|
|
|
4a2fec |
1 file changed, 6 insertions(+)
|
|
|
4a2fec |
|
|
|
4a2fec |
diff --git a/dump.c b/dump.c
|
|
|
4a2fec |
index d9090a2..99117ba 100644
|
|
|
4a2fec |
--- a/dump.c
|
|
|
4a2fec |
+++ b/dump.c
|
|
|
4a2fec |
@@ -1536,6 +1536,12 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
|
|
4a2fec |
fprintf(stderr, "DUMP: total memory to dump: %lu\n", s->total_size);
|
|
|
4a2fec |
#endif
|
|
|
4a2fec |
|
|
|
4a2fec |
+ /* it does not make sense to dump non-existent memory */
|
|
|
4a2fec |
+ if (!s->total_size) {
|
|
|
4a2fec |
+ error_setg(errp, "dump: no guest memory to dump");
|
|
|
4a2fec |
+ goto cleanup;
|
|
|
4a2fec |
+ }
|
|
|
4a2fec |
+
|
|
|
4a2fec |
s->start = get_start_block(s);
|
|
|
4a2fec |
if (s->start == -1) {
|
|
|
4a2fec |
error_setg(errp, QERR_INVALID_PARAMETER, "begin");
|
|
|
4a2fec |
--
|
|
|
4a2fec |
1.8.3.1
|
|
|
4a2fec |
|