Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXJCo-0005Kb-Ha for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:53:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXJCk-0005Iu-NN for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:53:34 -0500 Received: from [199.232.76.173] (port=56336 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXJCk-0005Im-IN for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:53:30 -0500 Received: from verein.lst.de ([213.95.11.210]:58602) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NXJCk-0003B1-4O for qemu-devel@nongnu.org; Tue, 19 Jan 2010 13:53:30 -0500 Date: Tue, 19 Jan 2010 19:53:28 +0100 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 08/10] qcow2: Allow updating no refcounts Message-ID: <20100119185328.GB31526@lst.de> References: <1263816696-24122-1-git-send-email-kwolf@redhat.com> <1263816696-24122-9-git-send-email-kwolf@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1263816696-24122-9-git-send-email-kwolf@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org > #endif > - if (length <= 0) > + if (length < 0) { > return -EINVAL; > + } > + > start = offset & ~(s->cluster_size - 1); > last = (offset + length - 1) & ~(s->cluster_size - 1); > for(cluster_offset = start; cluster_offset <= last; So for legnth = 0, last will equal start and we'll never go through the loop. But should we really bother with all the other work in the function or just return 0 early on?