From patchwork Thu May 7 12:11:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1285200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aUBk52BX; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49HslZ4LFwz9sSc for ; Thu, 7 May 2020 22:12:10 +1000 (AEST) Received: from localhost ([::1]:58400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWfNo-0000i9-9k for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 08:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWfNN-0000do-2J for qemu-devel@nongnu.org; Thu, 07 May 2020 08:11:41 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:48702 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWfNM-0001Hg-1P for qemu-devel@nongnu.org; Thu, 07 May 2020 08:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588853498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yWIK2WHkaZ7PoBsR/efTku5ERSpbN52iLBpjRvBRm84=; b=aUBk52BXCW/lsdFzxgvClywrgJ0ngBgMVxqi9Kev8My+bSKBAKmIXbnOGSaky99tUpFAtb TxstpQ5DUcEdh5pYhSLAxcD3zSjCAmxU/gDZyAIQuF78iF+xHIohR9/kTxB59JDcDkyw4E cjWNVVAA7b9ZG9Y7i8vf0p2qr5h+cyY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-I4pGUAoqPf-mvMn6P8058Q-1; Thu, 07 May 2020 08:11:37 -0400 X-MC-Unique: I4pGUAoqPf-mvMn6P8058Q-1 Received: by mail-wm1-f69.google.com with SMTP id 72so3969232wmb.1 for ; Thu, 07 May 2020 05:11:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vkOiz5+/Or/F9UlBm2bD/eJ721rs8ZUrKCeW7YzdojA=; b=UHmTDAmfA6mXp+LCMhPZyr13DeUSrd8U9pIqNE7Fd5n2iuB/kal5y9BkpdEnNreR+7 UxgD03EMtKJY41s7W6hyNElRVHWcqwVctFsdGYN3llovU2JD6ErgO3tW3xWi0ik2AZwA FYF29GCC8Bk6OVpOzTfDxDdA/Oxc9+ShV/eW+8oqWiJyxZbdxbmwnBy1aplK4tXqrgaO HaXB0gTrOuL+rcjv3jKXHSsH9KrQC6j4Ihs0XuCFTQ3u9WduSQlHffViCSy0evyNKtYU 51b/ohg7Ocqz8hCIbGY28RgtOnKMfbw6Hu1/BQlQwbut16VpPpR3bkRmbBjW+g0uuxTt 3umQ== X-Gm-Message-State: AGi0PuYuF3axPLFGZFpyIKgpCl1FDtismaaUk1H3ymA0EQiRSToHyn2W 15a/tW18VlNit/c2SHm3x+L2GmcyAbQuxbnqbIVnyEimTQo1amMG/yWfp/vxBjQxukiFuilAZVj /8zn9AuYJnYQV+uY= X-Received: by 2002:adf:e450:: with SMTP id t16mr16420893wrm.301.1588853495830; Thu, 07 May 2020 05:11:35 -0700 (PDT) X-Google-Smtp-Source: APiQypLoDqmQk78n0oGh5Q7LPEFCvVDqtsjoMbc+seVsA+rilXX6q9Lry+ejELZJgUYNIDTLJHlMvA== X-Received: by 2002:adf:e450:: with SMTP id t16mr16420879wrm.301.1588853495686; Thu, 07 May 2020 05:11:35 -0700 (PDT) Received: from x1w.redhat.com (248.red-88-21-203.staticip.rima-tde.net. [88.21.203.248]) by smtp.gmail.com with ESMTPSA id c17sm7889111wrn.59.2020.05.07.05.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 05:11:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/2] block/block-copy: Fix uninitialized variable in block_copy_task_entry Date: Thu, 7 May 2020 14:11:28 +0200 Message-Id: <20200507121129.29760-2-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507121129.29760-1-philmd@redhat.com> References: <20200507121129.29760-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 00:55:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-trivial@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Fix when building with -Os: CC block/block-copy.o block/block-copy.c: In function ‘block_copy_task_entry’: block/block-copy.c:428:38: error: ‘error_is_read’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 428 | t->call_state->error_is_read = error_is_read; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake --- block/block-copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/block-copy.c b/block/block-copy.c index 03500680f7..83e16c89d9 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -418,7 +418,7 @@ out: static coroutine_fn int block_copy_task_entry(AioTask *task) { BlockCopyTask *t = container_of(task, BlockCopyTask, task); - bool error_is_read; + bool error_is_read = false; int ret; ret = block_copy_do_copy(t->s, t->offset, t->bytes, t->zeroes, From patchwork Thu May 7 12:11:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1285202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=2001:470:142::17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D4Zm97/y; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49HspD5j76z9sSg for ; Thu, 7 May 2020 22:14:28 +1000 (AEST) Received: from localhost ([::1]:39680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWfQ1-0004jX-SM for incoming@patchwork.ozlabs.org; Thu, 07 May 2020 08:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWfNR-0000pB-Hm for qemu-devel@nongnu.org; Thu, 07 May 2020 08:11:45 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52912 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jWfNQ-0001IW-R9 for qemu-devel@nongnu.org; Thu, 07 May 2020 08:11:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588853503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y7CZXWmOlzkPDw3ChgdIHxPbxxhNLd9Vo76+h31WmPg=; b=D4Zm97/y+Pu2OPnk9/6+iXQy7JCQrhudAZMuVBoKTTjBmz56asXzfe/CFFaSs/l32Zbebs nMaq3+N2TdNMRx9OSgJSwUBzE567uFH5qgFDoC/tZYj3DUkSaOgHpyMrWWNJPQAlcKcqXx 8nbPQ8I/TzX30F3kfaSu/HDHTvPL1Eo= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-fS2J4axrNo2BfxXlY4vfWA-1; Thu, 07 May 2020 08:11:42 -0400 X-MC-Unique: fS2J4axrNo2BfxXlY4vfWA-1 Received: by mail-wm1-f69.google.com with SMTP id n127so2416320wme.4 for ; Thu, 07 May 2020 05:11:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZZ2/ambaHE8VhJjgmhxpgBUMEyLaxhrdquoTUVQ9dy0=; b=VzsIYPHbElrLEmSvDgribxFhfxR4u81DGv7ndXwYzTwzr9PfJEMZOQ8qwWWKQrcDSf Tg8Eh7w5Tvjcik0P07M0pAUXbpEJ2w2vJeuGsv/hDq+itt3jjQVshPhACbYqrQw2ooSA l4j9HUK9GnCx5zHDVjRjGt3VpKDVXyCueOAXMM+Lmrv3Ht9V6ufn55eQDjHOef4dxPv4 MrMA4kinujCQnKgmboD19Bq+ZHGkO57VArs+C/NL1+TtQPxAtZGoW2QdMG/d6pjGp835 d7b+c/6R0sb4OHP0DKsSidgYUTeCRqdgJlZ6J4ugvY3fqiwGflxNLcqjmxD6G5oxHg6F Jn0A== X-Gm-Message-State: AGi0PuY2gUGvsUju+aSPWbNBdv14HVHTejym4t3NsqmQRhYlZ6SSUfJR +lp5dwdK/oOIojYfxu6Af06uiahNEBDXxUPiZ285ZQExYZ8V2j4S6uXfIarVmoiRmxS9KC420Lx Le9/TeRSrC+HvxsA= X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr10632098wmg.110.1588853500612; Thu, 07 May 2020 05:11:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJSF8oG7QplyhjKGqHJMPP5ZsxjW4dc6j+pQ8T/c3dghHLieQonfoBK/OTVoWgUUdzHmJHBzg== X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr10632084wmg.110.1588853500427; Thu, 07 May 2020 05:11:40 -0700 (PDT) Received: from x1w.redhat.com (248.red-88-21-203.staticip.rima-tde.net. [88.21.203.248]) by smtp.gmail.com with ESMTPSA id q2sm2372018wrm.42.2020.05.07.05.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 05:11:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/2] block/block-copy: Simplify block_copy_do_copy() Date: Thu, 7 May 2020 14:11:29 +0200 Message-Id: <20200507121129.29760-3-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200507121129.29760-1-philmd@redhat.com> References: <20200507121129.29760-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 02:00:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-trivial@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" block_copy_do_copy() is static, only used in block_copy_task_entry with the error_is_read argument set. No need to check for it, simplify. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake --- block/block-copy.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index 83e16c89d9..e8455b817a 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -343,9 +343,7 @@ static int coroutine_fn block_copy_do_copy(BlockCopyState *s, ~BDRV_REQ_WRITE_COMPRESSED); if (ret < 0) { trace_block_copy_write_zeroes_fail(s, offset, ret); - if (error_is_read) { - *error_is_read = false; - } + *error_is_read = false; } return ret; } @@ -393,9 +391,7 @@ static int coroutine_fn block_copy_do_copy(BlockCopyState *s, ret = bdrv_co_pread(s->source, offset, nbytes, bounce_buffer, 0); if (ret < 0) { trace_block_copy_read_fail(s, offset, ret); - if (error_is_read) { - *error_is_read = true; - } + *error_is_read = true; goto out; } @@ -403,9 +399,7 @@ static int coroutine_fn block_copy_do_copy(BlockCopyState *s, s->write_flags); if (ret < 0) { trace_block_copy_write_fail(s, offset, ret); - if (error_is_read) { - *error_is_read = false; - } + *error_is_read = false; goto out; }