Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp822013ybz; Fri, 24 Apr 2020 09:50:22 -0700 (PDT) X-Google-Smtp-Source: APiQypIczI2/WoOTXbumfHrhs9HFyWcW9vhiYoy8DFO3L8G4B2hEelgN7OAH6EYiohpPiioPfVWB X-Received: by 2002:a17:906:c839:: with SMTP id dd25mr7795975ejb.164.1587747021807; Fri, 24 Apr 2020 09:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587747021; cv=none; d=google.com; s=arc-20160816; b=LQFhiiO0CBW/oB6TSvSDSH1+CSug/eLJpwhLoZtarFwX4rog3qM+Eb9FOZ5tzTuGZ3 dxDw8KLbI/3+LeolBb5h1SkdmWg/qxM2oUi0ldhLyky2ASsByVBJ3XnoDdt4iad/4I6S zC/HBoUKmd4ie+WOvV8T6ILvJ/ZSKlo7wZ29dYjaY0DNkf8JU8tckGibBH+ZZBkFJ7qo H+/PGH1wh7bM8IhEMbqyUjdrdnGa62jgL/BQL+IBJoN/bCGrExaX+lpEyBZf8xQn33a4 M75YN9v7u8SVbotvqdAUdUg47HRz9WGUT14sM/1HVjhAQP0Z5ic3ZBtocim26tPXEHje VekQ== 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=HFY5EWQxJQBE/a8g9zWXLsX7Zf8fLYpIOthjFiz7W8w=; b=DRzYGUl+bEoxZfLpk6AYH3lXI2SP1w3VnpNKfKM1xDofeHa1jCJba2BKA/yz3NNmbg sRbTh7nT7jZlyHhec5YB2Lgx11h2rrCbrHPMvR7v0LJNfGwErZado3gTbrjqeTXvIWnV xpc/TuP435iqFpaNankqlfAKO+9Y4k4WmnP0Px6O87i9paI+W4T6hTkUN5tGP32taJcE Cnnus5V61QCg02mDl1Mre+3JPf7v2e+n448LVu3sO20wJxwenn/K5eEi3viux1zV/gH7 rKkE2+BeF/1IHaBe2eZ+KyoDxkYGfjj7e6y/n8UNKFlXGivE6Zl9LhCR3ufsAnVPknwO 4PLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TCcC7xwD; 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 ch12si3449353ejb.36.2020.04.24.09.49.58; Fri, 24 Apr 2020 09:50:21 -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=TCcC7xwD; 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 S1728786AbgDXQrn (ORCPT + 99 others); Fri, 24 Apr 2020 12:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbgDXQrW (ORCPT ); Fri, 24 Apr 2020 12:47:22 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80746C09B046 for ; Fri, 24 Apr 2020 09:47:22 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id r14so5058230pfg.2 for ; Fri, 24 Apr 2020 09:47:22 -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=HFY5EWQxJQBE/a8g9zWXLsX7Zf8fLYpIOthjFiz7W8w=; b=TCcC7xwDHAu9bmMF/+GZJa9vYkDZgMmKcLfjPMMC7WxFy96i5XJInX1GDHyX5hGgdn k0DHASh+feTCGxn6dHfnxFh+vuxggc5OZU1RyzKGe7xq/76OwHGkQczLW1lVwVC3cIfQ 4oRy227wWf7qGKFO47+zGDd0ULkr361+0sQ9c= 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=HFY5EWQxJQBE/a8g9zWXLsX7Zf8fLYpIOthjFiz7W8w=; b=tw7hTaCvhf0IAO25SEFpvEtfOoAKJoqVlmzLGCrTz1bBigfSOXx9v5mOp+TAJI8hCF zhuBUaQt5Jjfb+/7nCMsbsrmJsD+pLuh2W4l81Ee+DUjUmPAYdbBVgkc0EHwDnFmFfb7 K1qKoVaK68aG83Avip+fFo/Mz9DhrHZBsruClEsEguAZoie/ZiHB/8LBwxa8UCMWEpb4 CvZlScZT8WM/ilA5E8X/TgSgFSEo/C8YRjjcmfX7RXs0xvqkoucqhNgGf62VwKY2Ax1H LkMzbHPuD2vEHPCbSRr95+MNYD1sQhctjle1HbuNvWTh03tWnO3v4vZB+0Y/H/neOBft a7oA== X-Gm-Message-State: AGi0PubBlBYOGrtaCK5F3wf6ZWL0bGbVMObMy9WpKNzFAOw2G+H5W0HD 92T62ik3XZvLimVXN3iR1SJLTQ== X-Received: by 2002:a63:8ac3:: with SMTP id y186mr9550995pgd.277.1587746842085; Fri, 24 Apr 2020 09:47:22 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id r28sm6319205pfg.186.2020.04.24.09.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 09:47:21 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , rafael.j.wysocki@intel.com, Andy Gross , Bjorn Andersson Cc: evgreen@chromium.org, mka@chromium.org, mkshah@codeaurora.org, swboyd@chromium.org, Douglas Anderson , Alexios Zavras , Allison Randal , Colin Cross , Kevin Hilman , Santosh Shilimkar , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH v5 3/5] kernel/cpu_pm: Fix uninitted local in cpu_pm Date: Fri, 24 Apr 2020 09:46:55 -0700 Message-Id: <20200424094610.v5.3.I2d44fc0053d019f239527a4e5829416714b7e299@changeid> X-Mailer: git-send-email 2.26.2.303.gf8c07b1a785-goog In-Reply-To: <20200424094610.v5.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> References: <20200424094610.v5.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 Reviewed-by: Stephen Boyd --- Changes in v5: None 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.2.303.gf8c07b1a785-goog