PM / Suspend: Off by one in pm_suspend()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 21 Sep 2011 18:55:04 +0000 (20:55 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Sun, 16 Oct 2011 21:27:46 +0000 (23:27 +0200)
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
kernel/power/suspend.c

index 595a3dd56a8a832c9029086de9b2a11460951d3d..fdd4263b995d4c1e15f26188b3dacf47d30dec08 100644 (file)
@@ -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++;