Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1164116ybz; Wed, 22 Apr 2020 14:59:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKJoua65lYLlx/mGUvuBVvai6yPAoV5A/txAn9IXPz7hmvvntx2FlabDoqR9jEQYExWtgeH X-Received: by 2002:a17:906:5c43:: with SMTP id c3mr333559ejr.3.1587592768205; Wed, 22 Apr 2020 14:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587592768; cv=none; d=google.com; s=arc-20160816; b=BRY5+afKhnDcSDpEnSOK+S9HzMcl+PPKOmQPKvq0EjWMTkGV24dFyEhrzwMagxIatZ JME7eltF8g2pHgLIvQBBT06X05gjrxzHtZsJjPmLIuyeZVzqnBaMxnXC7yVkx660Ti57 8K8rlXfgQ0IdL4T2qK62JwLxG0wyFPhmzUlQk0lCx0mw4MOEGnx0M2a6lSEL+phTM3vT eyEHDu9qXwP/IO36pCLWLXX0UCbHKsnSFgWHMJr9Gyax72GVGskeStmn+5eUoyGI+TAT woxwp3/Uyi95XJRB5MX9OTRMgS4lGTSfgO2lMIHcl6DcfcouI76Pfx+wo90lAz2jiKXs h36g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wu6rd3tUIo0urKDW7FHRI8bts8pWDDPJv5e+oxOpE44=; b=SzqTklJR8EjW6oTjp7txzvN9GB8VgFTeRVz06eyHPUFUGSEW/3azwY9MF28xEzEJ5a N+h0ihNh8B9MmQa/3mLX/akHZ3qQ7MEBVjL2nd76mL08yphuM8wyB6nhbGCDVSuvwXrx Lc8XB18BAbjMT4k7tBY3iwBbEWvCv5ZTN84/k1pqH4U2OtjnPgCrzo6Zutddl5KxOO/d GqlzsdhFOalId0zNW0D6X5OU9k3CwnI4au9rq9OfhVwds9duCMbAVpIEJuJ4l4QZU5rL uBuWp4tVI1SgakgbRRGxrF6W70rjjweC4dSL7JwCwOBZ7DB+sTiFwGC2U1sQGHRTfhyf /C/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hO4Hi8MG; 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 dk9si206273edb.403.2020.04.22.14.59.05; Wed, 22 Apr 2020 14:59:28 -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=hO4Hi8MG; 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 S1726458AbgDVVzk (ORCPT + 99 others); Wed, 22 Apr 2020 17:55:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbgDVVz1 (ORCPT ); Wed, 22 Apr 2020 17:55:27 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F0DC03C1A9 for ; Wed, 22 Apr 2020 14:55:27 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x15so1837379pfa.1 for ; Wed, 22 Apr 2020 14:55:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=wu6rd3tUIo0urKDW7FHRI8bts8pWDDPJv5e+oxOpE44=; b=hO4Hi8MGx9eLnl+pLA+BDPLAvfzlGhY/Bu6gAF5WLjwgBz00y3N9U38zlTj3+2QwHE tjxX8SN4v4Ek3NMKRDzZaLFNuU+1IOyY1KHjB/CYE29Wr/T0bUHYimUSh5f7edIvBW0Y q6YH6R31YPFwckzXnm2qfN4n5f9XrdX6lCcHo= 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=wu6rd3tUIo0urKDW7FHRI8bts8pWDDPJv5e+oxOpE44=; b=OCZDcACDcJSl6F+pDOPCKVJOg9Y7qC4Mmlp6zyAYtHZZo7kHgHU7rmssoUUWL85OpG 5ZBuuc79Nr0I1PA+z4m4ptvkvdmavoDnuTZuRwhU80RCBAxPpp2ZUcosaO+T9i/eJFHT 3GHTDtLrT2/mhGcDdmL+XvlGMT2bvabKaBIZl1QsQvPuynVaU7pi4H3geYC9hEFIpteo 7fQ1WIr2XkGacc29vR2gcPS1l9FZnriyECudNEUKaOeHkn4HSQqStk4UPY1+cxQdR9e+ CaCsjKCCL+4m46KqrDjIgVyMNjgV6ceDkN7+eGU6X5/zG8h3Jvw4WdHYzER+lwkYIYX3 cMGQ== X-Gm-Message-State: AGi0PuYzzt0JEPPzxuLssag8AZe892BcrR4wDJ9lcDuJ9+Unxwsy0dOn Bus6d+ul6dUCcj0IaoR8pglahQ== X-Received: by 2002:a62:e113:: with SMTP id q19mr584566pfh.107.1587592526907; Wed, 22 Apr 2020 14:55:26 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id r4sm211072pgi.6.2020.04.22.14.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 14:55:26 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , rafael.j.wysocki@intel.com, Andy Gross , Bjorn Andersson Cc: mka@chromium.org, swboyd@chromium.org, mkshah@codeaurora.org, evgreen@chromium.org, Douglas Anderson , Alexios Zavras , Allison Randal , Colin Cross , Kevin Hilman , Santosh Shilimkar , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] kernel/cpu_pm: Fix uninitted local in cpu_pm Date: Wed, 22 Apr 2020 14:55:01 -0700 Message-Id: <20200422145408.v4.3.I2d44fc0053d019f239527a4e5829416714b7e299@changeid> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200422145408.v4.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> References: <20200422145408.v4.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> 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 v4: None Changes in v3: None 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