From 528f7ce6e439edeac38f6b3f8561f1be129b5e91 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 21 Sep 2011 20:55:04 +0200 Subject: PM / Suspend: Off by one in pm_suspend() 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 Signed-off-by: Rafael J. Wysocki Cc: stable@kernel.org --- kernel/power/suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/power') diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 595a3dd56a8a..fdd4263b995d 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -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++; -- cgit v1.2.3-58-ga151