Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5374540imb; Thu, 7 Mar 2019 14:13:22 -0800 (PST) X-Google-Smtp-Source: APXvYqycmNI64M8dz/N+IhlWYisEDfDs4nyz2nU4zsjdpDkMVNxYHJNIJcb76w4LQatNQnNSkpI7 X-Received: by 2002:a63:d112:: with SMTP id k18mr13686313pgg.426.1551996802089; Thu, 07 Mar 2019 14:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551996802; cv=none; d=google.com; s=arc-20160816; b=GfKYxPbVffaw5yxqpFhftgMVkMr7VtTtTELVyP/L8N5urOINz7ktzt1NAG3QiQevFH FDfkGBK+b+G/MUU/K+1f1zJs0y8ORNNt+6osvQzC997fF//7m/EizGJbHZn7a8ap7cNl 78ZvPqNIApg5UPiZXd3iY9B4Q42KbSGP2drtBOSIadyQiiJwL+N3BO7EXUB4FcdR7Zxm P6JPtuBa9zD4Hvq+Gbvm7DI8xf+ODh3hV7xkoIyFgA713K7Jkj7PmV0iu4jyAwUrLPI8 /uAcdPtcjqSMP4vSrit/mzaZUL6B1Fdn9QJmSbgiOYrx5de7zvkx8TBxYD3mOvjNY3PS ShoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TXb0s9/VA6uDrjEIjqzsVE7IYs9tLVulYfN8P5V0iLI=; b=x7bWNVYDFz7I/fUOnLMZ3hKjkhR1m9/tkRYG93qc956k8TgaCt4r3lL4ImLzeguHGR lWqkZTvUFapj1Yw/8hS1sqx1juq6PK/d7ynoidL1RWQ4bZKGVO/w79fpAAcBDSbLajwH Ml/Nwr3r8Y/9CDGWjG+RgbEviYr7AnE4FONdCSEMukRvS0T1sJd3rV/WXmEAfrHkJ5mb HNNxUy9dpIXVewmXb0RTtXi5MW9raM2nwfOQ1vG+R3M2CFO+VtkKP8DLhG9qJrM0QLZ0 QYVVOd7sgtBKLT3vqIcA0lPrqKaL6Cek8MyVX5ym2+OJAylMzM90ZcdQJ21jnoOo4GUZ +aFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aa7OqwoB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 75si4752749pgb.230.2019.03.07.14.13.06; Thu, 07 Mar 2019 14:13:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aa7OqwoB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbfCGWLJ (ORCPT + 99 others); Thu, 7 Mar 2019 17:11:09 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:39571 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfCGWLJ (ORCPT ); Thu, 7 Mar 2019 17:11:09 -0500 Received: by mail-ed1-f67.google.com with SMTP id p27so14807028edc.6; Thu, 07 Mar 2019 14:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TXb0s9/VA6uDrjEIjqzsVE7IYs9tLVulYfN8P5V0iLI=; b=aa7OqwoBj2RHugmTvRqNIv+wYV+9IVcdAEtwY7MLBh7tlDRkHMbDVGFGJIHfLkbu6v qptFYqmFtQgZ8Q6QDC59QlZ1a9S/WLHDx6nNWld3dI+gnIhN9rhQT+POlpFY2MDcQYc/ wMpmo7+ZSdDeEhPdUG/I5BAFnoLxMSIgIR7b/VpTE2NH2s+Z6Ki7KUYdVsf/1MK+MwUU gLbJesovR4+RYFdm28MFrAEKLsZdXZUuSY8o9vnCAXCnIEGWROMpzg7Ycggz4bi+xu+m vMprnhhjlxRJ2ItgkcBauwpoz9E06nQ+ue8AMkx2oKchI0JPFI8eg0I+GbwCNc+SpB++ 7b3A== 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:mime-version :content-transfer-encoding; bh=TXb0s9/VA6uDrjEIjqzsVE7IYs9tLVulYfN8P5V0iLI=; b=NFs1+N/L+vJ0i5145B8GdEsIo/e2DZ1R/xaRgTMi09lURDflenvXVBK80nefR9Heb5 O5E3Bgf8VaK9rrTNn3vY9ex7ODg6SInznvNaMMvenU1kumeG5/EN7m94sqonA6rj6TWw sfBbdxMNuzFQZK8EBYJDEt9nJvLoRONXjHMr5dpEprlfFGrSyqZuSyVSynBc0hpVsJT9 jjKaBT9t/2J3ClDzzUd2dtSMh7QyBiWhvI4ixc3+XFRE515CJkf32avrqB7kogzsg0aE FP1/Xe4/MWBMR6GYiRPD06lHD5q9EXNIWsRMVmdGezdcAzJZ6LPO5ohlOz7dmWqQOiC8 nNaQ== X-Gm-Message-State: APjAAAU6s4VMLzpm+wGdPg3204qNbKLp+4ByuypglfPMth32N7KtqbUK HfJV7fTp2omKwRBTzvZ0zxE= X-Received: by 2002:a50:b3ad:: with SMTP id s42mr30244511edd.142.1551996667286; Thu, 07 Mar 2019 14:11:07 -0800 (PST) Received: from localhost.localdomain ([2a01:4f9:2a:1fae::2]) by smtp.gmail.com with ESMTPSA id c50sm1688585edc.81.2019.03.07.14.11.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 14:11:06 -0800 (PST) From: Nathan Chancellor To: Coly Li , Kent Overstreet Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor Subject: [PATCH] bcache: Zero initialize bucket in bch_allocator_thread Date: Thu, 7 Mar 2019 15:10:54 -0700 Message-Id: <20190307221054.13126-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building with -Wsometimes-uninitialized, Clang warns: drivers/md/bcache/alloc.c:333:4: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] fifo_pop expands to a conditional depending on '!fifo_empty(...)', which is the same condition as the while loop. It seems Clang can't piece together that this condition will never been false as long as we are in the while loop because they are the same condition. It's easy enough to silence this warning by just explicitly zero initializing bucket. Link: https://github.com/ClangBuiltLinux/linux/issues/396 Signed-off-by: Nathan Chancellor --- drivers/md/bcache/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c index 5002838ea476..c72094901ac6 100644 --- a/drivers/md/bcache/alloc.c +++ b/drivers/md/bcache/alloc.c @@ -328,7 +328,7 @@ static int bch_allocator_thread(void *arg) * the free list: */ while (!fifo_empty(&ca->free_inc)) { - long bucket; + long bucket = 0; fifo_pop(&ca->free_inc, bucket); -- 2.21.0