Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1364679pxb; Fri, 1 Oct 2021 09:07:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8xwshpycXNW/indYgDL6YCkeMUAkB/GtYQ/UlSbijvVxhXyM80HQjiHX2jIflVMmpNhvp X-Received: by 2002:a17:906:480a:: with SMTP id w10mr3660990ejq.262.1633104423425; Fri, 01 Oct 2021 09:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633104423; cv=none; d=google.com; s=arc-20160816; b=u/2evHt/MEIkEdXuX6U2IJkV23i8cTVtxtugIZJqRdLCxEWGVqKumk0LDw/nnmAJ2f gFmpjOkfwKnRGtfG9iaXvQEpPD3fzxuyuBZmSLhKkqvJ5F1ojtz3dofW6L4ovztdfeQn bsc75JlPrY19/RSikHbZ7Gxucq92OgSoD3Ck+P8g+iji+CdUwaPVZf/P2DzH0euX0wkt BpUW4WJZCkBlzjCsNxYZJDewPKCFjRrePa8E9SDyEYkWuAWPcM3kWBiUBM9K5Svs5Elb I+Zi/Wcx4b0SUzCsu+2YpAPccAWJGGN23zbP3RUxxiCodhfuIHjRBifggI5oRwjz5or7 sVAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=b1GcB3oG9NqGusbKrUGSQKD+G28ahqfAw2Cr3bjhI4c=; b=wzy1wjEnoBNPsnb7gKBbad4OfeJfVkWxqPZBI5duesVlHw4z16B5QyVTUwacUuN933 FVQK7T66hLeWgq1/nqal7ODMWkRnFfYYbtrEu+5ECrwanOspUaYUvApt8ZpsUYCx3UIR zVpMtq0dh34oe2bEF5DxAO8/TYGmVOuCzty9tu54vaYWD2eBC/pe/g4cnHfNsdmN73iV C8c6ofGTgqUSC/eRdTOxzOPQ/KfninSNlL2qExazgPhaFiOHgP3JnVOvEZCs9LBDMsSD 6PON3qmV6v81H1fHg1SSLgHZGlrj62X/usLuZMpTEReqiTQ+KEcPSKKYWqU4euvRMR9T GhQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=P4K+BKZm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si7291138ejk.783.2021.10.01.09.06.36; Fri, 01 Oct 2021 09:07:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=P4K+BKZm; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354866AbhJAPH3 (ORCPT + 99 others); Fri, 1 Oct 2021 11:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354827AbhJAPHV (ORCPT ); Fri, 1 Oct 2021 11:07:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904CCC0613E4; Fri, 1 Oct 2021 08:05:36 -0700 (PDT) Date: Fri, 01 Oct 2021 15:05:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633100734; h=from:from:sender:sender:reply-to: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=b1GcB3oG9NqGusbKrUGSQKD+G28ahqfAw2Cr3bjhI4c=; b=P4K+BKZmhTT0xvPgfsd3Z9ZDhkFi4OLyEt/9GdJlW11TycgioK6lk2rEAqmZz/Rp56kHtf vXR8KAgiCenUqeeAz6lFoBsIpBw5r4KbpfrdClS9/S5G+6p5iSOatzxb/TDdYKYrfJ9gYD ga22olwceMUWEdhAIV1ixM6KYiDtH5D+SsqNm5+LCe1HFzMO0OIsMBeWOB1N3XZPyEcZVX gei+GVc3piXAtHweXJmYqunZ7ZZSL79nVxmY4cipClo33d0vWQnpjk+fKA5+knCmLoeOyB qrBgXeqwXl2G1EtxoAPCcvE4c/BeTevuHCwJHBe0aZooLMovtdDuhblRJIxbCQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633100734; h=from:from:sender:sender:reply-to: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=b1GcB3oG9NqGusbKrUGSQKD+G28ahqfAw2Cr3bjhI4c=; b=utpQs1RaCqB5hiE0ithLxDCWNPo5IxUUSczskoOGqBbaoZbjavf6/fb8FzNf1vLBHU0jui N580p1F9U0HYPIBw== From: "tip-bot2 for Nathan Chancellor" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/ww-mutex: Fix uninitialized use of ret in test_aa() Cc: "kernelci.org bot" , Stephen Rothwell , Nathan Chancellor , "Peter Zijlstra (Intel)" , Waiman Long , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210922145822.3935141-1-nathan@kernel.org> References: <20210922145822.3935141-1-nathan@kernel.org> MIME-Version: 1.0 Message-ID: <163310073387.25758.2474180500160006249.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 1415b49bcd321bca7347f43f8b269c91ec46d1dc Gitweb: https://git.kernel.org/tip/1415b49bcd321bca7347f43f8b269c91ec46d1dc Author: Nathan Chancellor AuthorDate: Wed, 22 Sep 2021 07:58:22 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 01 Oct 2021 13:57:49 +02:00 locking/ww-mutex: Fix uninitialized use of ret in test_aa() Clang warns: kernel/locking/test-ww_mutex.c:138:7: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (!ww_mutex_trylock(&mutex, &ctx)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/test-ww_mutex.c:172:9: note: uninitialized use occurs here return ret; ^~~ kernel/locking/test-ww_mutex.c:138:3: note: remove the 'if' if its condition is always false if (!ww_mutex_trylock(&mutex, &ctx)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/locking/test-ww_mutex.c:125:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 error generated. Assign !ww_mutex_trylock(...) to ret so that it is always initialized. Fixes: 12235da8c80a ("kernel/locking: Add context to ww_mutex_trylock()") Reported-by: "kernelci.org bot" Reported-by: Stephen Rothwell Signed-off-by: Nathan Chancellor Signed-off-by: Peter Zijlstra (Intel) Acked-by: Waiman Long Link: https://lore.kernel.org/r/20210922145822.3935141-1-nathan@kernel.org --- kernel/locking/test-ww_mutex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c index d63ac41..3530041 100644 --- a/kernel/locking/test-ww_mutex.c +++ b/kernel/locking/test-ww_mutex.c @@ -135,7 +135,8 @@ static int test_aa(bool trylock) goto out; } } else { - if (!ww_mutex_trylock(&mutex, &ctx)) { + ret = !ww_mutex_trylock(&mutex, &ctx); + if (ret) { pr_err("%s: initial trylock failed!\n", __func__); goto out; }