mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@firmix.at>
To: "P. Christeas" <p_christ@hol.gr>
Cc: acpi-devel@lists.sourceforge.net, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.6.0-test4: Trivial /sys/power/state patch, sleep status report
Date: 26 Aug 2003 00:40:18 +0200	[thread overview]
Message-ID: <1061851218.12331.23.camel@gimli.at.home> (raw)
In-Reply-To: <200308260125.30194.p_christ@hol.gr>

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

On Tue, 2003-08-26 at 00:25, P. Christeas wrote:
> Just found out that by 'echo sth_wrong > /sys/power/state' the kernel would 
> oops in a fatal way (no clean exit from there).
> The oops suggested that the code would enter an invalid fn.
> 
> You may apply the included patch to solve the bug. IMHO doing a clean exit is 
> much preferrable than having BUG() there.
[...]
> ----
[...]
> 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
> @@ -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;

What do you think about the attached patch to solve the bug and remove a
warning?

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services

[-- Attachment #2: power-main.patch --]
[-- Type: text/plain, Size: 393 bytes --]

--- linux-2.6.0-test4/kernel/power/main.c	Sat Aug 23 01:53:13 2003
+++ linux-2.6.0-test4-patched/kernel/power/main.c	Mon Aug 25 21:16:50 2003
@@ -492,7 +492,7 @@
 static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n)
 {
 	u32 state;
-	struct pm_state * s;
+	struct pm_state * s = NULL;
 	int error;
 
 	for (state = 0; state < PM_SUSPEND_MAX; state++) {

  reply	other threads:[~2003-08-25 22:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-25 22:25 P. Christeas
2003-08-25 22:40 ` Bernd Petrovitsch [this message]
2003-08-25 22:47   ` P. Christeas
2003-08-25 22:57     ` Bernd Petrovitsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1061851218.12331.23.camel@gimli.at.home \
    --to=bernd@firmix.at \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p_christ@hol.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®