From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnVGt-0003mv-2v for qemu-devel@nongnu.org; Thu, 22 May 2014 11:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnVGi-0007Ff-Rf for qemu-devel@nongnu.org; Thu, 22 May 2014 11:51:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnVGi-0007FR-K1 for qemu-devel@nongnu.org; Thu, 22 May 2014 11:50:56 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4MFotQY022230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 22 May 2014 11:50:55 -0400 Date: Thu, 22 May 2014 17:50:53 +0200 From: Stefan Hajnoczi Message-ID: <20140522155053.GC21238@stefanha-thinkpad.redhat.com> References: <1400689698-3096-1-git-send-email-kwolf@redhat.com> <1400689698-3096-3-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1400689698-3096-3-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 02/20] block: Handle failure for potentially large allocations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Wed, May 21, 2014 at 06:28:00PM +0200, Kevin Wolf wrote: > @@ -2270,7 +2270,10 @@ int bdrv_commit(BlockDriverState *bs) > } > > total_sectors = length >> BDRV_SECTOR_BITS; > - buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE); > + > + /* qemu_try_blockalign() for bs will choose an alignment that works for > + * bs->backing_hd as well, so no need to compare the alignment manually. */ > + buf = qemu_try_blockalign(bs, COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE); Missing ENOMEM error handling?