linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle / ACPI: fix potential NULL pointer dereference
@ 2012-10-08  0:40 Wei Yongjun
  2012-10-09  2:51 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-10-08  0:40 UTC (permalink / raw)
  To: lenb; +Cc: yongjun_wei, linux-acpi

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/acpi/processor_idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 3655ab9..e8086c7 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
 int acpi_processor_hotplug(struct acpi_processor *pr)
 {
 	int ret = 0;
-	struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id);
+	struct cpuidle_device *dev;
 
 	if (disabled_by_idle_boot_param())
 		return 0;
@@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
 	if (!pr->flags.power_setup_done)
 		return -ENODEV;
 
+	dev = per_cpu(acpi_cpuidle_device, pr->id);
 	cpuidle_pause_and_lock();
 	cpuidle_disable_device(dev);
 	acpi_processor_get_power_info(pr);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpuidle / ACPI: fix potential NULL pointer dereference
  2012-10-08  0:40 [PATCH] cpuidle / ACPI: fix potential NULL pointer dereference Wei Yongjun
@ 2012-10-09  2:51 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2012-10-09  2:51 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: yongjun_wei, linux-acpi

Applied.

thanks,
Len Brown, Intel Open Source Technology Center

On 10/07/2012 08:40 PM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The dereference should be moved below the NULL test.
> 
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/acpi/processor_idle.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 3655ab9..e8086c7 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
>  int acpi_processor_hotplug(struct acpi_processor *pr)
>  {
>  	int ret = 0;
> -	struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id);
> +	struct cpuidle_device *dev;
>  
>  	if (disabled_by_idle_boot_param())
>  		return 0;
> @@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
>  	if (!pr->flags.power_setup_done)
>  		return -ENODEV;
>  
> +	dev = per_cpu(acpi_cpuidle_device, pr->id);
>  	cpuidle_pause_and_lock();
>  	cpuidle_disable_device(dev);
>  	acpi_processor_get_power_info(pr);
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-09  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08  0:40 [PATCH] cpuidle / ACPI: fix potential NULL pointer dereference Wei Yongjun
2012-10-09  2:51 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).