From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbbHaHT1 (ORCPT ); Mon, 31 Aug 2015 03:19:27 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:35258 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752531AbbHaHTZ (ORCPT ); Mon, 31 Aug 2015 03:19:25 -0400 Date: Mon, 31 Aug 2015 12:49:20 +0530 From: Viresh Kumar To: =?utf-8?B?5L+e5Lyf?= Cc: "Rafael J. Wysocki" , linux-kernel , linux-pm , yuweieric Subject: Re: [PATCH 1/1] fix cpufreq/cpufreq.c null pointer access issue Message-ID: <20150831071920.GB5215@linux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29-08-15, 01:32, 俞伟 wrote: > Hi, > This patch fixes an issue in cpufreq_init_policy(). > > Best regards, > Yu Wei You have done the right thing in the wrong way. Firstly, this is not how you send patches. Please read Documentation/SubmittingPatches for right details.. Secondly, this is even more screwed up as you sent it as html :) > Subject: [PATCH] cpufreq: print the last governor while restoring governor > > Commit 35afd02e30d6 ("cpufreq: Initialize the governor again while > restoring policy") clears policy->governor to initialize the governor This isn't the patch which broke it, but this one: 6e2c89d16d98 ("cpufreq: move call to __find_governor() to cpufreq_init_policy()") > while restoring governor. The policy->governor is NULL and > find_governor() returns last used governor matching last_governor > string, so print last_governor instead of policy->governor->name. > Add this line here: Fixes: 6e2c89d16d98 ("cpufreq: move call to __find_governor() to cpufreq_init_policy()") > Signed-off-by: Yu Wei > > --- > drivers/cpufreq/cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 7a3c30c..5a9e50e 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1072,7 +1072,7 @@ static void cpufreq_init_policy(struct cpufreq_policy > *policy) > gov = find_governor(policy->last_governor); > if (gov) > pr_debug("Restoring governor %s for cpu %d\n", > - policy->governor->name, policy->cpu); > + policy->last_governor, policy->cpu); The right thing to do here is to print gov->name instead. > else > gov = CPUFREQ_DEFAULT_GOVERNOR; > > -- > 1.9.1 > > SECURITY NOTE: file ~/.netrc must not be accessible by others -- viresh