From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwTpC-0003nt-7b for qemu-devel@nongnu.org; Mon, 16 Jun 2014 06:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwTp6-0006Ow-3B for qemu-devel@nongnu.org; Mon, 16 Jun 2014 06:07:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwTp5-0006Op-Qs for qemu-devel@nongnu.org; Mon, 16 Jun 2014 06:07:32 -0400 Message-ID: <539EC1D5.4060208@redhat.com> Date: Mon, 16 Jun 2014 12:07:17 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <0c6badd4ed1f0f3af9de36e4b5a17952922fdd05.1402720673.git.hutao@cn.fujitsu.com> <539C815B.3000203@redhat.com> <20140615095847.GA11294@redhat.com> <20140616095428.GC6179@G08FNSTD100614.fnst.cn.fujitsu.com> In-Reply-To: <20140616095428.GC6179@G08FNSTD100614.fnst.cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , "Michael S. Tsirkin" Cc: Yasunori Goto , qemu-devel@nongnu.org, Igor Mammedov Il 16/06/2014 11:54, Hu Tao ha scritto: >>> > > This needs an audit of all callers or, alternatively, we need to add >>> > > memory_region_init_ram_nofail. Better leave it for after the merge. > Paolo, IIUC you suggested we fix it after merge. Yes. >> > Specifically memory_region_init_ram_from_file does not seem to >> > handle failures. > memory_region_init_ram_from_file has an errp. Also see my updated patch. Yes, memory_region_init_ram_from_file is okay. memory_region_init_ram is the one that doesn't handle failures. > > qemu_ram_free chunk also looks weird. Can we not avoid calling > > free on invalid addresses? > > but we still need to check the address somewhere if not in > qemu_ram_free. If we add an errp to memory_region_init_ram, the qemu_ram_free hunk probably will not be necessary anymore. Paolo