From patchwork Wed Jun 24 15:28:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 488115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B2177140320 for ; Thu, 25 Jun 2015 01:37:51 +1000 (AEST) Received: from localhost ([::1]:51360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7mkH-0003oa-KZ for incoming@patchwork.ozlabs.org; Wed, 24 Jun 2015 11:37:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7mbQ-0004y3-GQ for qemu-devel@nongnu.org; Wed, 24 Jun 2015 11:28:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7mbP-0006V6-Dy for qemu-devel@nongnu.org; Wed, 24 Jun 2015 11:28:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7mbP-0006Un-7P for qemu-devel@nongnu.org; Wed, 24 Jun 2015 11:28:39 -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 (Postfix) with ESMTPS id DD8FFB82C9; Wed, 24 Jun 2015 15:28:38 +0000 (UTC) Received: from localhost (ovpn-112-73.ams2.redhat.com [10.36.112.73]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5OFSbZ7027410; Wed, 24 Jun 2015 11:28:38 -0400 From: Stefan Hajnoczi To: Date: Wed, 24 Jun 2015 16:28:06 +0100 Message-Id: <1435159686-14817-16-git-send-email-stefanha@redhat.com> In-Reply-To: <1435159686-14817-1-git-send-email-stefanha@redhat.com> References: <1435159686-14817-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Peter Maydell , Gonglei , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 15/15] virito-blk: drop duplicate check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gonglei in_num = req->elem.in_num, and req->elem.in_num is checked in line 489, so the check about in_num variable is superflous, let's drop it. Signed-off-by: Gonglei Reviewed-by: Fam Zheng Message-id: 1435138164-11728-1-git-send-email-arei.gonglei@huawei.com Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index bbb1fc1..6aefda4 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -499,8 +499,7 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) iov_discard_front(&iov, &out_num, sizeof(req->out)); - if (in_num < 1 || - in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { + if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { error_report("virtio-blk request inhdr too short"); exit(1); }