[06/25] PM / Suspend: Off by one in pm_suspend()

From: Greg KH
Date: Tue Nov 22 2011 - 19:34:18 EST


2.6.32-longterm review patch. If anyone has any objections, please let me know.

------------------
Content-Length: 833
Lines: 29

From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>


---
kernel/power/suspend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -293,7 +293,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;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/