From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDvmj-0004Pk-9x for qemu-devel@nongnu.org; Mon, 26 Aug 2013 08:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDvmY-0003RZ-D8 for qemu-devel@nongnu.org; Mon, 26 Aug 2013 08:20:41 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:47228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDvmX-0003R5-NU for qemu-devel@nongnu.org; Mon, 26 Aug 2013 08:20:30 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Aug 2013 17:42:36 +0530 From: "Aneesh Kumar K.V" In-Reply-To: <521A8281.6070401@suse.de> References: <1377235210-27093-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1377235210-27093-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <02FA64AE-6862-4306-8E8E-919C253F7028@suse.de> <521A8281.6070401@suse.de> Date: Mon, 26 Aug 2013 17:50:16 +0530 Message-ID: <878uzoej9b.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH -V3 3/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: Andreas =?utf-8?Q?F=C3=A4rber?= , Alexander Graf Cc: qemu-ppc , Paul Mackerras , qemu-devel , Luiz Capitulino Andreas F=C3=A4rber writes: > Am 25.08.2013 20:32, schrieb Alexander Graf: >>=20 >> On 23.08.2013, at 06:20, Aneesh Kumar K.V wrote: >>=20 >>> From: "Aneesh Kumar K.V" >>> >>> When we translate the virtual address to physical check for error. >>> >>> Signed-off-by: Aneesh Kumar K.V >>=20 >> I think this change is sane, but I'd really prefer to see an ack from (o= r get this applied by) Luiz. >>=20 >>=20 >> Alex >>=20 >>> --- >>> 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, con= st char *filename, >>> l =3D sizeof(buf); >>> if (l > size) >>> l =3D size; >>> - cpu_memory_rw_debug(cpu, addr, buf, l, 0); >>> + if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) !=3D 0) { >>> + error_set(errp, QERR_INVALID_PARAMETER, "addr"); > > I've been repeatedly told error_set() should no longer be used, in favor > of error_setg(). :) > Updated to=20 commit 23aa279e11f54808dd9f0f87b3c85e6303d00d9c Author: Aneesh Kumar K.V Date: Tue Aug 20 16:14:23 2013 +0530 target-ppc: Check for error on address translation in memsave command =20=20=20=20 When we translate the virtual address to physical check for error. =20=20=20=20 Signed-off-by: Aneesh Kumar K.V diff --git a/cpus.c b/cpus.c index 0f65e76..51c38a0 100644 --- a/cpus.c +++ b/cpus.c @@ -1309,7 +1309,10 @@ void qmp_memsave(int64_t addr, int64_t size, const c= har *filename, l =3D sizeof(buf); if (l > size) l =3D size; - cpu_memory_rw_debug(cpu, addr, buf, l, 0); + if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) !=3D 0) { + error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified\n", a= ddr); + goto exit; + } if (fwrite(buf, 1, l, f) !=3D l) { error_set(errp, QERR_IO_ERROR); goto exit;