From patchwork Mon Aug 22 07:55:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reda Sallahi X-Patchwork-Id: 661367 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 3sHmN16Rgdz9sxN for ; Mon, 22 Aug 2016 18:05:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=wG+390QR; dkim-atps=neutral Received: from localhost ([::1]:40185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbkEh-0004M9-OB for incoming@patchwork.ozlabs.org; Mon, 22 Aug 2016 04:05:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbk5e-0004b3-5G for qemu-devel@nongnu.org; Mon, 22 Aug 2016 03:56:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbk5T-0004hC-SR for qemu-devel@nongnu.org; Mon, 22 Aug 2016 03:56:13 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbk5T-0004go-Lt; Mon, 22 Aug 2016 03:56:03 -0400 Received: by mail-wm0-x243.google.com with SMTP id q128so12205967wma.1; Mon, 22 Aug 2016 00:56:03 -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=xRp8+bQ2SL0mOB6M56RU6cAs6T0BeYf3DY8Gl9GAZDE=; b=wG+390QREbpwNVxHhow1R35hivCk544SaO9z/2dz7m+3705lpAVZXtcDuSp1tVFB8Z t22TqNKfby33SUddfFEUFDXv7gZytaCDaAKyts8+8r6aVkYdclYiJ1HG4305mfgCcbjJ ydkM67fNS70+ZB20bLq+acrmYZIdoSo9v5jsgNFGi/OBQwdTXRntWFAVT/BY/rK26s/U 4w+AdGBDLqfKWIv/nOs915awi++sDblAdCWGjyv0mSa0g3PoU5jNqvjGt16D0TrQ8DBX qBoWSoodRE4rdSeDq0P7nAB2b+BAP2VmtlkfCMrCeGYEcZuowKuckSXw+Xjk8O0R7tpl VSpw== 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=xRp8+bQ2SL0mOB6M56RU6cAs6T0BeYf3DY8Gl9GAZDE=; b=dxxqvBT4pKYA/0hglgqkkZgDXMjr6HGlCpNuLHfBexadc1WxfM6twYmPiBfRZPBtTa KStmDdn/zFp7kCV5RtC9TvmcZ7cLBsUkKhuRIlpreknl/8GzW9cS+ElvXtaI0gITvtpl qNIK08UABdttxDjH9rgJvwIJXVT7qHCGsZsJrONdHIvLTkaE/aY8RWDHn2NqL0MIvvbD SsqNe0qUePN7CdWdGnF4fGhbOSz9tMwaLCE4zi6ftWRIBPAfq2bhCJNiY1Pc1dusz1Xg gQ7dfRnSCcjePlnnVqPKLlRdhVUk9CinIuDmHIAL5kmLlpYgjuC0ip9D688ALNByjZ/J KNEg== X-Gm-Message-State: AEkoouvgUA9aYBziL82trzhZsGhcL1fdXDvoHQf7ZUjuZSbTu1e8jJgOpgiASwOsow808g== X-Received: by 10.194.114.135 with SMTP id jg7mr16605586wjb.166.1471852562840; Mon, 22 Aug 2016 00:56:02 -0700 (PDT) Received: from cinque_stelle.sm14.sm.cri.epita.net ([163.5.208.89]) by smtp.gmail.com with ESMTPSA id uo4sm22329922wjc.36.2016.08.22.00.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2016 00:56:02 -0700 (PDT) From: Reda Sallahi To: qemu-devel@nongnu.org Date: Mon, 22 Aug 2016 09:55:14 +0200 Message-Id: <20160822075517.5859-5-fullmanet@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160822075517.5859-1-fullmanet@gmail.com> References: <20160822075517.5859-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::243 Subject: [Qemu-devel] [PATCH 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 ae3828e..cf78dfe 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4093,7 +4093,7 @@ static int img_dd(int argc, char **argv) const char *out_fmt = "raw"; const char *fmt = NULL; 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; @@ -4373,8 +4373,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)). */ @@ -4386,7 +4385,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;