Skip to content

Commit

Permalink
PM / Suspend: Off by one in pm_suspend()
Browse files Browse the repository at this point in the history
In enter_state() we use "state" as an offset for the pm_states[]
array.  The pm_states[] array only has PM_SUSPEND_MAX elements so
this test is off by one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: stable@kernel.org
  • Loading branch information
Dan Carpenter authored and Rafael J. Wysocki committed Oct 16, 2011
1 parent 85055dd commit 528f7ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/power/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ int enter_state(suspend_state_t state)
int pm_suspend(suspend_state_t state)
{
int ret;
if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX) {
if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX) {
ret = enter_state(state);
if (ret) {
suspend_stats.fail++;
Expand Down

0 comments on commit 528f7ce

Please sign in to comment.