Skip to content

Commit e8b1b59

Browse files
Wei Yongjunlenb
Wei Yongjun
authored andcommitted
cpuidle / ACPI: fix potential NULL pointer dereference
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 <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent f5a246e commit e8b1b59

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/acpi/processor_idle.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
11321132
int acpi_processor_hotplug(struct acpi_processor *pr)
11331133
{
11341134
int ret = 0;
1135-
struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id);
1135+
struct cpuidle_device *dev;
11361136

11371137
if (disabled_by_idle_boot_param())
11381138
return 0;
@@ -1147,6 +1147,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
11471147
if (!pr->flags.power_setup_done)
11481148
return -ENODEV;
11491149

1150+
dev = per_cpu(acpi_cpuidle_device, pr->id);
11501151
cpuidle_pause_and_lock();
11511152
cpuidle_disable_device(dev);
11521153
acpi_processor_get_power_info(pr);

0 commit comments

Comments
 (0)