[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/47] memsave: Improve and disambiguate error messag
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 04/47] memsave: Improve and disambiguate error message |
Date: |
Wed, 4 Mar 2015 20:06:21 +0300 |
From: Borislav Petkov <address@hidden>
When requesting a size which cannot be read, the error message shows
a different address which is misleading to the user and it looks like
something's wrong with the address parsing. This is because the input
@addr variable is incremented in the memory dumping loop:
(qemu) memsave 0xffffffff8418069c 0xb00000 mem
Invalid addr 0xffffffff849ffe9c specified
Fix that by saving the original address and size and use them in the
error message:
(qemu) memsave 0xffffffff8418069c 0xb00000 mem
Invalid addr 0xffffffff8418069c/size 11534336 specified
Signed-off-by: Borislav Petkov <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
cpus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 0fac143..1ce90a1 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1474,6 +1474,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char
*filename,
uint32_t l;
CPUState *cpu;
uint8_t buf[1024];
+ int64_t orig_addr = addr, orig_size = size;
if (!has_cpu) {
cpu_index = 0;
@@ -1497,7 +1498,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char
*filename,
if (l > size)
l = size;
if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
- error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified", addr);
+ error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
+ " specified", orig_addr, orig_size);
goto exit;
}
if (fwrite(buf, 1, l, f) != l) {
--
2.1.4
- [Qemu-devel] [PULL 00/47] Trivial patches for 2015-03-04, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 12/47] block: remove superfluous '\n' around error_report/error_setg, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 02/47] xen-pt: fix Out-of-bounds read, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 04/47] memsave: Improve and disambiguate error message,
Michael Tokarev <=
- [Qemu-devel] [PULL 40/47] disas/cris: Fix warning caused by missing 'static' attribute, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 19/47] xtensa: Remove superfluous '\n' around error_report(), Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 05/47] smbios: document cmdline options for smbios type 2-4, 17 structures, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 17/47] vhost-scsi: Remove superfluous '\n' around error_report(), Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 39/47] disas/arm: Fix warnings caused by missing 'static' attribute, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 36/47] gitignore: Ignore new tests, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 10/47] qerror.h: Swap definitions that were not in alphabetical order, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 06/47] migration/rdma: clean up qemu_rdma_dest_init a bit, Michael Tokarev, 2015/03/04
- [Qemu-devel] [PULL 15/47] numa: remove superfluous '\n' around error_setg, Michael Tokarev, 2015/03/04