]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:37:17 +0000 (09:37 -0800)
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>
kernel/power/suspend.c

index 1c41ba215419d4d086fc27113caa20bcc8a81d6d..449ccc9c0a4f43f1aed15d4ceea408c7ae4b89e4 100644 (file)
@@ -307,7 +307,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;
 }