diff -Bbur /diskb/users/panos/linux-off/kernel/power/main.c /usr/src/linux/kernel/power/main.c --- /diskb/users/panos/linux-off/kernel/power/main.c 2003-08-23 12:13:17.000000000 +0300 +++ /usr/src/linux/kernel/power/main.c 2003-08-26 00:59:34.000000000 +0300 @@ -304,6 +304,20 @@ goto Unlock; } +# if 1 /* disable once we're sure we got it right */ + /* double - check code */ + if (!s ) { + printk (KERN_ERR "Invalid suspend state %d\n",state); + error = -EINVAL; + goto Unlock ; + } + if (! s->fn) { + printk(KERN_ERR "Invalid fn for suspend state %d\n", state ); + error = -EINVAL ; + goto Unlock; + } +# endif + pr_debug("PM: Preparing system for suspend.\n"); if ((error = suspend_prepare(state))) goto Unlock; @@ -500,7 +514,7 @@ if (s->name && !strcmp(buf,s->name)) break; } - if (s) + if ( (s) && (state < PM_SUSPEND_MAX) ) error = enter_state(state); else error = -EINVAL;