summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-09-21 20:55:04 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-11 09:44:47 -0800
commitca9b9d7bf6fc89a8a72c6aa37c683d02b7782b0b (patch)
treed67b10f7f60352f00772a0064d2a5093f9e46fb4
parent4d25350da904f3e4d8f0da1e41a4d9807bb3525b (diff)
downloadlinux-stable-ca9b9d7bf6fc89a8a72c6aa37c683d02b7782b0b.tar.gz
linux-stable-ca9b9d7bf6fc89a8a72c6aa37c683d02b7782b0b.tar.bz2
linux-stable-ca9b9d7bf6fc89a8a72c6aa37c683d02b7782b0b.zip
PM / Suspend: Off by one in pm_suspend()
commit 528f7ce6e439edeac38f6b3f8561f1be129b5e91 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>
-rw-r--r--kernel/power/suspend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index b6b71ad2208f..d3caa7634987 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -315,7 +315,7 @@ int enter_state(suspend_state_t state)
*/
int pm_suspend(suspend_state_t state)
{
- if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX)
+ if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
return enter_state(state);
return -EINVAL;
}