From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MEgee-0000ln-M5 for qemu-devel@nongnu.org; Thu, 11 Jun 2009 05:33:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MEgeZ-0000gn-Fb for qemu-devel@nongnu.org; Thu, 11 Jun 2009 05:33:03 -0400 Received: from [199.232.76.173] (port=55192 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MEgeY-0000gQ-JA for qemu-devel@nongnu.org; Thu, 11 Jun 2009 05:32:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:48417) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MEgeY-0007Yn-5K for qemu-devel@nongnu.org; Thu, 11 Jun 2009 05:32:58 -0400 From: Gerd Hoffmann Date: Thu, 11 Jun 2009 11:32:48 +0200 Message-Id: <1244712771-14432-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1244712771-14432-1-git-send-email-kraxel@redhat.com> References: <1244712771-14432-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH RESEND 1/4] xen_disk: move sanity check to the correct place List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, xen-devel@lists.xensource.com Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/xen_disk.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/xen_disk.c b/hw/xen_disk.c index f95e373..659a839 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq) switch (ioreq->req.operation) { case BLKIF_OP_READ: ioreq->prot = PROT_WRITE; /* to memory */ - if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { - xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); - goto err; - } break; case BLKIF_OP_WRITE_BARRIER: if (!syncwrite) @@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq) goto err; }; + if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') { + xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n"); + goto err; + } + ioreq->start = ioreq->req.sector_number * blkdev->file_blk; for (i = 0; i < ioreq->req.nr_segments; i++) { if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) { -- 1.6.2.2