mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Patrick Mochel <mochel@osdl.org>
Cc: kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [pm] fix oops after saving image
Date: Thu, 2 Oct 2003 22:39:06 +0200	[thread overview]
Message-ID: <20031002203906.GB7407@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0310020933140.997-100000@localhost.localdomain>

Hi!

> > --- tmp/linux/kernel/power/swsusp.c	2003-10-02 00:04:35.000000000 +0200
> > +++ linux/kernel/power/swsusp.c	2003-10-01 23:56:49.000000000 +0200
> > @@ -345,7 +348,7 @@
> >  	printk( "|\n" );
> >  
> >  	MDELAY(1000);
> > -	free_page((unsigned long) buffer);
> > +	/* Trying to free_page((unsigned long) buffer) here is bad idea, not sure why */
> >  	return 0;
> >  }
> 
> Patches like this really do a disservice to anyone trying to read the code 
> and figure out what is going on. I've spent a considerable amount of time 
> deciphering and santizing the swsusp code, which is why pmdisk exists. 
> 
> The patch is simply a band-aid, and completely meaningless without the 
> context of the email. If I applied this, one would be able to ascertain 
> the reason for the patch, if they manipulated the BK tools correctly. 
> However, seeing that line solely in the context on the rest of the source 
> makes one cock their head, squint their eyes and pray that they never have 
> to look at that file again. 
> 
> If you're seeing an Oops, please search more for the cause and submit a 
> real fix for it. 
> 
> Or, simply change the semantics of the code enough to eliminate the
> possibility of a problem. In the pmdisk code, I've statically declared the 
> header, so we don't need that alloc/free. Please see that file for an 
> example. 

I do not want to waste 4K, does this look better?
									Pavel

--- tmp/linux/kernel/power/swsusp.c	2003-10-02 22:29:06.000000000 +0200
+++ linux/kernel/power/swsusp.c	2003-10-02 22:27:07.000000000 +0200
@@ -283,6 +283,9 @@
 	unsigned long address;
 	struct page *page;
 
+	if (!buffer)
+		return -ENOMEM;
+
 	printk( "Writing data to swap (%d pages): ", nr_copy_pages );
 	for (i=0; i<nr_copy_pages; i++) {
 		if (!(i%100))
@@ -345,7 +348,7 @@
 	printk( "|\n" );
 
 	MDELAY(1000);
-	free_page((unsigned long) buffer);
+	/* No need to free anything, system is going down, anyway. */
 	return 0;
 }
 


-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

  reply	other threads:[~2003-10-02 20:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01 22:37 Pavel Machek
2003-10-02 16:40 ` Patrick Mochel
2003-10-02 20:39   ` Pavel Machek [this message]
2003-10-03 21:38     ` Patrick Mochel
2003-10-03 22:33       ` Pavel Machek
2003-10-04  5:17         ` Stan Bubrouski
2003-10-04  8:02           ` Pavel Machek
2003-10-04  7:50             ` Nigel Cunningham
2003-10-04 16:27               ` Stan Bubrouski
2003-10-04 16:26             ` Stan Bubrouski
2003-10-04 16:39               ` Pavel Machek
2003-10-04 16:53                 ` Stan Bubrouski
2003-10-06 22:30         ` Patrick Mochel

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=20031002203906.GB7407@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /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®