All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block2mtd oops in erase function.
@ 2007-02-19 21:29 Felix Fietkau
  2007-02-19 22:20 ` Jörn Engel
  0 siblings, 1 reply; 12+ messages in thread
From: Felix Fietkau @ 2007-02-19 21:29 UTC (permalink / raw)
  To: linux-mtd

Hi, I have a small fix for a crash that happened when I was using jffs2
in combination with block2mtd.c

In the erase function when checking the block to see if it's already
erased, the limit is to be set to the page_address(page) + PAGE_SIZE,
but because the variable has the type (ulong *), it gets set to
PAGE_SIZE*sizeof(ulong), which makes the kernel oops when the page is
very close to the end of RAM.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

--- linux.dev/drivers/mtd/devices/block2mtd.c.old	2007-02-18 14:08:59.519952312 +0100
+++ linux.dev/drivers/mtd/devices/block2mtd.c	2007-02-18 14:09:04.219237912 +0100
@@ -111,7 +111,7 @@
 		if (IS_ERR(page))
 			return PTR_ERR(page);
 
-		max = (u_long*)page_address(page) + PAGE_SIZE;
+		max = (u_long*) ((u8 *) page_address(page) + PAGE_SIZE);
 		for (p=(u_long*)page_address(page); p<max; p++)
 			if (*p != -1UL) {
 				lock_page(page);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-02-21 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-19 21:29 [PATCH] block2mtd oops in erase function Felix Fietkau
2007-02-19 22:20 ` Jörn Engel
2007-02-19 22:30   ` Jörn Engel
2007-02-20  2:27     ` Felix Fietkau
2007-02-20 10:53       ` Jörn Engel
2007-02-20 21:35         ` Jason Lunz
2007-02-20 21:55           ` Jörn Engel
     [not found]             ` <20070221030254.GA11044@avocado.homenet>
2007-02-21 14:47               ` Jörn Engel
2007-02-21 15:42                 ` Jason Lunz
2007-02-21 16:02                   ` Jörn Engel
2007-02-21 20:26                     ` Jason Lunz
2007-02-21 21:43                       ` Jörn Engel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.