Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1878209ybz; Thu, 16 Apr 2020 17:34:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLLsYrT/UxMnASycvz6ceT+sWx/7FlN5FauPlxdPayqE5W3O1bnDuW5/UDkNHQ7voYbK6v5 X-Received: by 2002:a17:906:6944:: with SMTP id c4mr649851ejs.96.1587083643827; Thu, 16 Apr 2020 17:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587083643; cv=none; d=google.com; s=arc-20160816; b=eRVuYf29l6cqW+ElvASS/BLkWAMRz8I2Fj4luYnVvPEsyZMJzxGqUT4ACZD3u4mawW hxWwQ1Msho0+HL2/HGhe1lTDWC+neeGDv2tNM42LhW6lieFQuMADnMcjW53fNecRFGVj zb+iAyhcJHG1OjoM1MErpDayWLDY+DSqGw3A3iIy0kWndU2lRFlfLAH3xG01Ia6hYMUT YAXTMWHuWYHDxkVgGBpbpx/9t+uVOrxT0cEHCeX+jBNycItGOBVPDeiou0n3XPjt+nTt GK3oqnJJ6CFJAmcCT3mdI/BDdHKjvWzqqLG1StZ3e5ucMLoUA6tp+aUR4Uh3r0ywGUbF /JJg== 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=NjEXDjSMTeg2qVqhFWHQox519X/O5z/MdvyGKQSYndw=; b=kVdz38Vrg3PlKIcN2EfeeRYIC2aC9JG2UKePswumDCpCwReUHegT+M3fiwOnsyDbQt UjR5MMTn+HAp4ut06PuAebrBq5j5hWW+SeQeRxSV/zwZksrKr2FzS/MWR2Mo+xVd/ho4 9B8A9sVSAjIydfmhi1kMEtUFOeVPqeckB+zncDCFfrwCVrzWcldjczabIlLG4ELSkYLx SOdInvgr9Pw/reZE/9Tg1YoYfHRPpnDsjdhngnLc4DMtRbzZatL6QRMo05OQM/tptIb+ IZof9c/hiXUEB4+pXlXXxaZTzFyBfM3vivFijaexZOhPl0wfgLe8GNkVS5ObmBS8wM3P 4atQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LDmaaFc7; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz1si12448685ejb.265.2020.04.16.17.33.34; Thu, 16 Apr 2020 17:34: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=@chromium.org header.s=google header.b=LDmaaFc7; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbgDQAc0 (ORCPT + 99 others); Thu, 16 Apr 2020 20:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725858AbgDQAcZ (ORCPT ); Thu, 16 Apr 2020 20:32:25 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A262C061A0C for ; Thu, 16 Apr 2020 17:32:25 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id t16so290703plo.7 for ; Thu, 16 Apr 2020 17:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NjEXDjSMTeg2qVqhFWHQox519X/O5z/MdvyGKQSYndw=; b=LDmaaFc7SjAfeaLjtN3Xfse/r3ppwmmVEI46gLQez/PP+e7i5BXX4wTRkxDnG1No27 oLp4tdQEIQRBa1kCjs81iBdDLPm54g6Z3Qy9eUNM7xhZV7bZOAdmIWzQCU1wP859XiDn pX6GKjh3egk0qRy1bwh+GR2CY9gZAHJCl4Dhk= 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=NjEXDjSMTeg2qVqhFWHQox519X/O5z/MdvyGKQSYndw=; b=KVlVz9PCwVaerk+0q07WzFxQafK78Cp3ikj+yDgv1obKalURjiYQoa9ubYpdoy1ALn k2GgGw/PS9lKBDPv1xXuR8sxw1eHo+2HRto4Ap09QQXVUTKrIAoCXMD4BWB/5cwcB+gA mBRzhnEc4rVvjwCRO7YKZF1CcGYr8/4WF6dircc3DAEjjAZXE6CKbu7tNS01HnVRdx/O LjVWesrLl+kGsSV3oRjh8N3gZziCrbQ8gCgy6XRC/5gyuBx1er7HHns3O/7YNi+K2o8A Ag8VMImfVDLdOGRexSMS4h8ZPtwHZsUjSIANjUGUAtkEhnLth5dJDvWGSpccepP9FCc/ +pxw== X-Gm-Message-State: AGi0PubF4cdr1d/DycfoK/jeGre+tgmwYHRf9DPRr3D+thESv+/35qfG K2mHZUTcJYWrjjv/gNkpqL54qg== X-Received: by 2002:a17:90a:6548:: with SMTP id f8mr1146021pjs.114.1587083544658; Thu, 16 Apr 2020 17:32:24 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id 18sm18090658pfv.118.2020.04.16.17.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 17:32:24 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , rafael.j.wysocki@intel.com, Andy Gross , Bjorn Andersson Cc: mkshah@codeaurora.org, evgreen@chromium.org, swboyd@chromium.org, mka@chromium.org, Douglas Anderson , Alexios Zavras , Allison Randal , Colin Cross , Kevin Hilman , Santosh Shilimkar , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] kernel/cpu_pm: Fix uninitted local in cpu_pm Date: Thu, 16 Apr 2020 17:31:59 -0700 Message-Id: <20200416173145.v2.1.I2d44fc0053d019f239527a4e5829416714b7e299@changeid> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cpu_pm_notify() is basically a wrapper of notifier_call_chain(). notifier_call_chain() doesn't initialize *nr_calls to 0 before it starts incrementing it--presumably it's up to the callers to do this. Unfortunately the callers of cpu_pm_notify() don't init *nr_calls. This potentially means you could get too many or two few calls to CPU_PM_ENTER_FAILED or CPU_CLUSTER_PM_ENTER_FAILED depending on the luck of the stack. Let's fix this. Fixes: ab10023e0088 ("cpu_pm: Add cpu power management notifiers") Signed-off-by: Douglas Anderson --- Changes in v2: - ("Fix uninitted local in cpu_pm") new for v2. kernel/cpu_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c index cbca6879ab7d..44a259338e33 100644 --- a/kernel/cpu_pm.c +++ b/kernel/cpu_pm.c @@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_unregister_notifier); */ int cpu_pm_enter(void) { - int nr_calls; + int nr_calls = 0; int ret = 0; ret = cpu_pm_notify(CPU_PM_ENTER, -1, &nr_calls); @@ -131,7 +131,7 @@ EXPORT_SYMBOL_GPL(cpu_pm_exit); */ int cpu_cluster_pm_enter(void) { - int nr_calls; + int nr_calls = 0; int ret = 0; ret = cpu_pm_notify(CPU_CLUSTER_PM_ENTER, -1, &nr_calls); -- 2.26.1.301.g55bc3eb7cb9-goog