From patchwork Thu Aug 2 14:39:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 1267641 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 118E4DF223 for ; Thu, 2 Aug 2012 14:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751453Ab2HBOsK (ORCPT ); Thu, 2 Aug 2012 10:48:10 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:22816 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082Ab2HBOsI (ORCPT ); Thu, 2 Aug 2012 10:48:08 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q72Em51L010032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Aug 2012 14:48:06 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q72Em55p014234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Aug 2012 14:48:05 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q72Em5uA005347; Thu, 2 Aug 2012 09:48:05 -0500 Received: from phenom.dumpdata.com (/209.6.85.33) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 02 Aug 2012 07:48:05 -0700 Received: by phenom.dumpdata.com (Postfix, from userid 1000) id 4F3B34029A; Thu, 2 Aug 2012 10:39:03 -0400 (EDT) From: Konrad Rzeszutek Wilk To: lenb@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Konrad Rzeszutek Wilk Subject: [PATCH] intel_idle: Check cpu_idle_get_driver() for NULL before dereferencing it. Date: Thu, 2 Aug 2012 10:39:01 -0400 Message-Id: <1343918341-25985-1-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 1.7.7.6 X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If the machine is booted without any cpu_idle driver set (b/c disable_cpuidle() has been called) we should follow other users of cpu_idle API and check the return value for NULL before using it. Reported-by: Mark van Dijk Tested-by: Mark van Dijk Suggested-by: Jan Beulich Signed-off-by: Konrad Rzeszutek Wilk --- drivers/idle/intel_idle.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index f559088..7383aa0 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -607,7 +607,7 @@ static int __init intel_idle_init(void) retval = cpuidle_register_driver(&intel_idle_driver); if (retval) { printk(KERN_DEBUG PREFIX "intel_idle yielding to %s", - cpuidle_get_driver()->name); + cpuidle_get_driver() ? cpuidle_get_driver()->name : "none"); return retval; }