Received: from eggs.gnu.org ([2001:4830:134:3::10]:51166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU26m-0005MU-KO for qemu-devel@nongnu.org; Fri, 06 Mar 2015 18:56:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YU26h-0007nU-A8 for qemu-devel@nongnu.org; Fri, 06 Mar 2015 18:56:44 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:43789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU26h-0007nL-36 for qemu-devel@nongnu.org; Fri, 06 Mar 2015 18:56:39 -0500 From: Michael Tokarev Date: Fri, 6 Mar 2015 23:18:47 +0300 Message-Id: <1425673176-9819-9-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1425673176-9819-1-git-send-email-mjt@tls.msk.ru> References: <1425673176-9819-1-git-send-email-mjt@tls.msk.ru> Subject: [Qemu-devel] [PATCH 04/51] memsave: Improve and disambiguate error message List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aneesh Kumar K.V" Cc: Borislav Petkov , Michael Tokarev , qemu-devel@nongnu.org From: Borislav Petkov 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 Signed-off-by: Michael Tokarev --- 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