From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjVe-0002c2-Eo for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:50:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBjVR-0001pG-HJ for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:49:58 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:35199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjVQ-0001nd-Tv for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:49:45 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Aug 2013 16:13:50 +0530 From: "Aneesh Kumar K.V" Date: Tue, 20 Aug 2013 16:19:26 +0530 Message-Id: <1376995766-16526-5-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1376995766-16526-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1376995766-16526-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH -V2 4/4] target-ppc: Check for error on address translation in memsave command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" When we translate the virtual address to physical check for error. Signed-off-by: Aneesh Kumar K.V --- cpus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 0f65e76..658366d 100644 --- a/cpus.c +++ b/cpus.c @@ -1309,7 +1309,10 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, l = sizeof(buf); if (l > size) l = size; - cpu_memory_rw_debug(cpu, addr, buf, l, 0); + if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) { + error_set(errp, QERR_INVALID_PARAMETER, "addr"); + goto exit; + } if (fwrite(buf, 1, l, f) != l) { error_set(errp, QERR_IO_ERROR); goto exit; -- 1.8.1.2