From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDvoa-0006VI-MD for qemu-devel@nongnu.org; Mon, 26 Aug 2013 08:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDvoU-0003sn-Cj for qemu-devel@nongnu.org; Mon, 26 Aug 2013 08:22:36 -0400 Message-ID: <521B4881.1040105@suse.de> Date: Mon, 26 Aug 2013 14:22:25 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 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> <878uzoej9b.fsf@linux.vnet.ibm.com> In-Reply-To: <878uzoej9b.fsf@linux.vnet.ibm.com> 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: "Aneesh Kumar K.V" Cc: qemu-ppc , Luiz Capitulino , Paul Mackerras , Alexander Graf , qemu-devel Am 26.08.2013 14:20, schrieb Aneesh Kumar K.V: > Andreas F=C3=A4rber writes: >=20 >> Am 25.08.2013 20:32, schrieb Alexander Graf: >>> >>> On 23.08.2013, at 06:20, Aneesh Kumar K.V wrote: >>> >>>> From: "Aneesh Kumar K.V" >>>> >>>> When we translate the virtual address to physical check for error. >>>> >>>> Signed-off-by: Aneesh Kumar K.V >>> >>> I think this change is sane, but I'd really prefer to see an ack from= (or get this applied by) Luiz. >>> >>> >>> Alex >>> >>>> --- >>>> 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 =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 fav= or >> of error_setg(). :) >> >=20 > Updated to=20 >=20 > commit 23aa279e11f54808dd9f0f87b3c85e6303d00d9c > Author: Aneesh Kumar K.V > Date: Tue Aug 20 16:14:23 2013 +0530 >=20 > target-ppc: Check for error on address translation in memsave comma= nd > =20 > When we translate the virtual address to physical check for error. > =20 > Signed-off-by: Aneesh Kumar K.V >=20 > 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, 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_setg(errp, "Invalid addr 0x%016" PRIx64 "specified\n= ", addr); Next trap is no \n please. ;) Andreas > + goto exit; > + } > if (fwrite(buf, 1, l, f) !=3D l) { > error_set(errp, QERR_IO_ERROR); > goto exit; >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg