All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] block2mtd oops in erase function.
Date: Mon, 19 Feb 2007 22:29:39 +0100	[thread overview]
Message-ID: <1171920579.4996.8.camel@celeron> (raw)

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);

             reply	other threads:[~2007-02-19 22:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19 21:29 Felix Fietkau [this message]
2007-02-19 22:20 ` [PATCH] block2mtd oops in erase function 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

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=1171920579.4996.8.camel@celeron \
    --to=nbd@openwrt.org \
    --cc=linux-mtd@lists.infradead.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 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.