Received: from eggs.gnu.org ([2001:4830:134:3::10]:55525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhFJx-0001HF-14 for qemu-devel@nongnu.org; Mon, 05 May 2014 05:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhFJq-0003uC-Eb for qemu-devel@nongnu.org; Mon, 05 May 2014 05:36:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhFJq-0003tg-6m for qemu-devel@nongnu.org; Mon, 05 May 2014 05:36:18 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s459aHGE031225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 5 May 2014 05:36:17 -0400 Date: Mon, 5 May 2014 11:36:15 +0200 From: Kevin Wolf Message-ID: <20140505093615.GD3317@noname.str.redhat.com> References: <1399174300-27583-1-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399174300-27583-1-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 04.05.2014 um 05:31 hat Max Reitz geschrieben: > If the very first allocation has a length of 0, the free_cluster_index > is still 0 after the for loop, which means that subtracting one from it > will underflow and signal an invalid range of clusters by returning > -EFBIG. However, there is no such range, as its length is 0. > > Fix this by preventing underflows on free_cluster_index during the > check. > > Signed-off-by: Max Reitz Heh, I wondered about this when I reviewed that other patch, and came to the conclusion that it probably doesn't happen. Did you find a case where it does happen in fact? Anyway, this can't hurt: Reviewed-by: Kevin Wolf