Received: from eggs.gnu.org ([2001:4830:134:3::10]:46227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyzuz-0007Q6-4d for qemu-devel@nongnu.org; Mon, 23 Jun 2014 04:48:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wyzuq-0004Nz-GX for qemu-devel@nongnu.org; Mon, 23 Jun 2014 04:48:01 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:58474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyzuq-0004MV-9t for qemu-devel@nongnu.org; Mon, 23 Jun 2014 04:47:52 -0400 Received: from blackfin.pond.sub.org (p5B329044.dip0.t-ipconnect.de [91.50.144.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 356272694F for ; Mon, 23 Jun 2014 10:47:48 +0200 (CEST) From: Markus Armbruster References: <1401970536-18019-1-git-send-email-armbru@redhat.com> <1401970536-18019-4-git-send-email-armbru@redhat.com> <20140620041618.GB11029@stefanha-thinkpad.redhat.com> Date: Mon, 23 Jun 2014 10:47:47 +0200 In-Reply-To: <20140620041618.GB11029@stefanha-thinkpad.redhat.com> (Stefan Hajnoczi's message of "Fri, 20 Jun 2014 12:16:18 +0800") Message-ID: <87ppi0m2q4.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, qemu-devel@nongnu.org, uobergfe@redhat.com Stefan Hajnoczi writes: > On Thu, Jun 05, 2014 at 02:15:36PM +0200, Markus Armbruster wrote: >> + if (sector > total_sectors || nb_sectors > total_sectors - sector) { >> + return false; >> + } > > if (sector >= total_sectors || ...) { I suspect reading bdrv_check_byte_request() put the '>' in my brain: if ((offset > len) || (len - offset < size)) return -EIO; Don't we need offset >= len here?