Skip to content

Commit ca9b9d7

Browse files
Dan Carpentergregkh
authored andcommitted
PM / Suspend: Off by one in pm_suspend()
commit 528f7ce upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 4d25350 commit ca9b9d7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/power/suspend.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ int enter_state(suspend_state_t state)
315315
*/
316316
int pm_suspend(suspend_state_t state)
317317
{
318-
if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
318+
if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
319319
return enter_state(state);
320320
return -EINVAL;
321321
}

0 commit comments

Comments
 (0)