From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ulI-0003yL-LG for qemu-devel@nongnu.org; Fri, 04 Jul 2014 00:06:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2ulB-0001ir-0u for qemu-devel@nongnu.org; Fri, 04 Jul 2014 00:06:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ulA-0001iS-Mc for qemu-devel@nongnu.org; Fri, 04 Jul 2014 00:06:04 -0400 Message-ID: <53B62824.2010209@redhat.com> Date: Thu, 03 Jul 2014 22:05:56 -0600 From: Eric Blake MIME-Version: 1.0 References: <53B54D98.2060800@redhat.com> <20140704025613.GC31329@G08FNSTD100614.fnst.cn.fujitsu.com> In-Reply-To: <20140704025613.GC31329@G08FNSTD100614.fnst.cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lIsVvBOW0M2mMHfFaGPSUQdTAJcfMaXcr" Subject: Re: [Qemu-devel] [PATCH for 2.1 2/2] memory-backend-file: improve error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Yasunori Goto , Igor Mammedov , Paolo Bonzini , qemu-devel@nongnu.org, "Michael S. Tsirkin" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lIsVvBOW0M2mMHfFaGPSUQdTAJcfMaXcr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/03/2014 08:56 PM, Hu Tao wrote: > On Thu, Jul 03, 2014 at 06:33:28AM -0600, Eric Blake wrote: >> On 07/03/2014 12:10 AM, Hu Tao wrote: >>> This patch fixes two problems of memory-backend-file: >>> >>> 1. If user adds a memory-backend-file object using object_add command= , >>> specifying a non-existing directory for property mem-path, qemu >>> will core dump with message: >>> >>> /nonexistingdir: No such file or directory >>> Bad ram offset fffffffffffff000 >>> Aborted (core dumped) >>> >>> 2. If user adds a memory-backend-file object using object_add command= , >>> specifying a size that is less than huge page size, qemu >>> will core dump with message: >>> >>> Bad ram offset fffffffffffff000 >>> Aborted (core dumped) >>> >> >> Might be nice if the commit message also shows the new message issued >> for the same cases after the patch is applied. >=20 > OK. >=20 >>> =20 >>> if (memory < hpagesize) { >>> - return NULL; >>> + error_setg(errp, "memory size 0x" RAM_ADDR_FMT " should be l= arger " >>> + "than huge page size 0x%" PRIx64, memory, hpagesi= ze); >>> + goto error; >> >> Isn't exactly equal also allowed? Maybe a better wording is "should b= e >> a multiple of the huge page size" >=20 > Yes. I'll change the error message. >=20 Thinking about it more, should you also enforce that it is a multiple? As in: if (!memory || memory % hpageszie) { error... } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lIsVvBOW0M2mMHfFaGPSUQdTAJcfMaXcr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTtigkAAoJEKeha0olJ0NqcXsH/0GDpWbd07JjB/T6B67A12eE y3hcFE14fydO7fBAHDwaZFhQLg3Kn7NfSbqlIkiZUuyXPUbra4WLM0KAd5/RD8vC t2YBd/zr54n0lj1G/hOur5CUAVOihce2G/Z9WA09uNHuVW+8QQbGiFDOSemBv1NC qduY3HKU1tPEQIpXOAlHc2wwcGh7KD6rkRGKqmRY9ssuKpi1DJf4E3W2zDhFPPVB h/grkajqQUcotqzC7QSMW0vY1QmEfPcI74UeKcS0VkgsHHqm/fZQmKANON+bt7gp knDTjuHbVD+nVG7jx+PxuKXENVO2s0oAibhY9H8A6S/ZPfxAuUccGLe/JK3OZFM= =NiuL -----END PGP SIGNATURE----- --lIsVvBOW0M2mMHfFaGPSUQdTAJcfMaXcr--