ACPI: Fixes device power states array overflow
Subsystems (2)
PATCH 1/1 ACPI: Fixes device power states array overflow
Commit 28c2103 added new state ACPI_STATE_D3_COLD, so the device power states array must be expanded by one also.
--- include/acpi/acpi_bus.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acpi_bus.h +1 -1
@@ -210,7 +210,7 @@ struct acpi_device_power_state {struct acpi_device_power {int state;/* Current state */ struct acpi_device_power_flags flags; -struct acpi_device_power_state states[4 ];/* Power states (D0-D3) */ +struct acpi_device_power_state states[5 ];/* Power states (D0-D3Cold) */ };/* Performance Management */
Signature · 1 line
1.7.2.3
Hi Lin,
Quoted 14 lines · Lin Ming
Commit 28c2103 added new state
ACPI_STATE_D3_COLD, so the device power states array must be expanded by one also.Reported-by Dan Carpenter <[email protected]>Signed-off-by Lin Ming <[email protected]>--- include/acpi/acpi_bus.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/acpi_bus.h +0
-0
include/acpi/acpi_bus.h struct acpi_device_power_state { · line 213
Quoted 5 lines
include/acpi/acpi_bus.h +1
-1@@ -210,7 +210,7 @@ struct acpi_device_power_state {struct acpi_device_power {int state;/* Current state */ struct acpi_device_power_flags flags; -struct acpi_device_power_state states[4 ];/* Power states (D0-D3) */ +struct acpi_device_power_state states[5 ];/* Power states (D0-D3Cold)
*/
Wouldn't it be better to use some constant, so that the same problem would not appear again in future - something like ACPI_D_STATE_COUNT or (maybe better) ACPI_D_STATES_MAX+1 instead of magic number 5?
Cheers,
Oldřich.
include/acpi/acpi_bus.h struct acpi_device_power_state { · line 216
Quoted 3 lines
include/acpi/acpi_bus.h +0
-0};/* Performance Management */
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · 在 2011-06-01三的 05:09 +0800,Oldřich Jedlička写道:
Hi Lin,
Quoted 14 lines · Lin Ming
Commit 28c2103 added new state
ACPI_STATE_D3_COLD, so the device power states array must be expanded by one also.Reported-by Dan Carpenter <[email protected]>Signed-off-by Lin Ming <[email protected]>--- include/acpi/acpi_bus.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/acpi_bus.h +0
-0include/acpi/acpi_bus.h struct acpi_device_power_state { · line 213
Quoted 5 lines
include/acpi/acpi_bus.h +1
-1@@ -210,7 +210,7 @@ struct acpi_device_power_state {struct acpi_device_power {int state;/* Current state */ struct acpi_device_power_flags flags; -struct acpi_device_power_state states[4 ];/* Power states (D0-D3) */ +struct acpi_device_power_state states[5 ];/* Power states (D0-D3Cold) */
Quoted 3 lines
Wouldn't it be better to use some constant, so that the same problem would not appear again in future - something like
ACPI_D_STATE_COUNTor (maybe better) ACPI_D_STATES_MAX+1 instead of magic number 5?
Nice catch, I have updated the patch.
Thanks.
Quoted 8 lines
Cheers,
Oldřich.Quoted 3 lines
include/acpi/acpi_bus.h +0
-0};/* Performance Management */
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html