From patchwork Fri Aug 26 09:16:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reda Sallahi X-Patchwork-Id: 9301003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D1F8607F0 for ; Fri, 26 Aug 2016 09:25:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F205295F1 for ; Fri, 26 Aug 2016 09:25:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33A93295F3; Fri, 26 Aug 2016 09:25:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEA55295F1 for ; Fri, 26 Aug 2016 09:25:20 +0000 (UTC) Received: from localhost ([::1]:59680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDO3-0007Wm-PZ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 26 Aug 2016 05:25:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDG4-00007N-DN for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdDG2-0003uT-GH for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:03 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:32946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDG2-0003uF-8Z; Fri, 26 Aug 2016 05:17:02 -0400 Received: by mail-wm0-x241.google.com with SMTP id o80so10559498wme.0; Fri, 26 Aug 2016 02:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BWFUlbyHuq14Roz4Iu9b1AwvVU2uGN1yDEpE3kyUEaY=; b=vjBVpWNaJW6pDraA5+3/Nr2yYQ2Mlh1jOTVI6mWWFLnV95Uy9HNAmeAN37iqrbcl+N sm1VQbUS7CpGR3UHSqFTnubh9Z15qQ7Eyw4YHnd8LLRY8MRJ76mRTJ0NnydS/MU6OjKv 5a9HW4+inLGtencoziaUno/E9eFt0vF9TFaL60u43T9+Y+xpiMwXW9BAOxNEu9IuF42a zK5qGGBNO/339EEvFFMcYWFMsG9QEElNXeGZpSl9MNfI1uZkVi1NAzzSDdI4e/BvljWI lNFpJL7GENxWrkV5gqp/8s7q9AJlQhOXL/kvSqQ9AjDPpvGGghllTxaphObuWQ3L2e4Q Z9IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BWFUlbyHuq14Roz4Iu9b1AwvVU2uGN1yDEpE3kyUEaY=; b=eVrxz5CELC+C0TH5bzxDDltZv0pWRNeL51OexAMkYu5OMe0PR2Mc0+8RdZVBlRpYVh eEQer8XPqK44dr/zLjeTCLvlNPuy/zKHuyIqFufFEyV54sTh8kbW54YyYQZI+iO+HWSV kwyddUS7uGkrsilq+ajhWhaBTtyu3sOJ7UChg94QKfmw1jUYULppNCAokPZTK5mo/aY/ u9McmAeMi/9BfjGunP4qKKgU9h92X/gUlCra++utLuCf10dfKmlhwB+6/RtwqsU4STK7 QuvUFbfLqezAznVR8JlKaDVIQ68LxLnlKhttaJtqOuRGNOI4yIiujWIh2A/px9BdfQMl GsSg== X-Gm-Message-State: AE9vXwPvZqaiJneqU+GTNWkx+pCMD3Vv9xWwuhWvdA/EgLbaoy+qXnj3w7V8FBED9SKDrA== X-Received: by 10.194.87.67 with SMTP id v3mr2556442wjz.103.1472203021599; Fri, 26 Aug 2016 02:17:01 -0700 (PDT) Received: from cinque_stelle.sm14.sm.cri.epita.net ([163.5.208.144]) by smtp.gmail.com with ESMTPSA id f4sm42716517wmf.8.2016.08.26.02.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Aug 2016 02:17:01 -0700 (PDT) From: Reda Sallahi To: qemu-devel@nongnu.org Date: Fri, 26 Aug 2016 11:16:40 +0200 Message-Id: <20160826091643.15841-5-fullmanet@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160826091643.15841-1-fullmanet@gmail.com> References: <20160826091643.15841-1-fullmanet@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH v2 4/7] qemu-img: delete not used variable and an unecessary check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Max Reitz , Reda Sallahi , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP block_count is not used in img_dd() and the C_SKIP check is unecessary so this patch removes both of them. Signed-off-by: Reda Sallahi Reviewed-by: Stefan Hajnoczi --- qemu-img.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index a4d0556..bd3e80d 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4066,7 +4066,7 @@ static int img_dd(int argc, char **argv) const char *fmt = NULL; const char *out_filename; int64_t size = 0, out_size = 0; - int64_t block_count = 0, out_pos, in_pos, sparse_count = 0; + int64_t out_pos, in_pos, sparse_count = 0; bool writethrough = false; int flags = 0; int ibsz = 0, obsz = 0, bsz; @@ -4344,8 +4344,7 @@ static int img_dd(int argc, char **argv) } } - if (dd.flags & C_SKIP && (in.offset > INT64_MAX / ibsz || - size < in.offset * ibsz)) { + if (in.offset > INT64_MAX / ibsz || size < in.offset * ibsz) { /* We give a warning if the skip option is bigger than the input * size and create an empty output disk image (i.e. like dd(1)). */ @@ -4357,7 +4356,7 @@ static int img_dd(int argc, char **argv) in.buf = g_new(uint8_t, in.bsz); - for (out_pos = out.offset * obsz; in_pos < size; block_count++) { + for (out_pos = out.offset * obsz; in_pos < size;) { int in_ret, out_ret; bsz = in.bsz;