public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* mtd_dataflash bug
@ 2009-05-13  1:15 Tobias Simon
  2009-05-13 12:12 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Simon @ 2009-05-13  1:15 UTC (permalink / raw)
  To: linux-mtd

Hello List,

i have figured out a bug in mtd_datflash.c of kernel 2.6.29, which 
causes my ARM bootloader to be killed with every "erase" operation on 
arbitrary adresses. The fix is:

--- linux-2.6.29.2-a/drivers/mtd/devices/mtd_dataflash.c  2009-05-13 
03:11:16.000000000 +0200
+++ linux-2.6.29.2-b/drivers/mtd/devices/mtd_dataflash.c     2009-05-13 
03:13:30.000000000 +0200
@@ -184,7 +184,7 @@
                /* Calculate flash page address; use block erase (for 
speed) if
                 * we're at a block boundary and need to erase the whole 
block.
                 */
-               pageaddr = div_u64(instr->len, priv->page_size);
+               pageaddr = div_u64(instr->addr, priv->page_size);
                do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
                pageaddr = pageaddr << priv->page_offset;

Regards,
Tobias

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

* Re: mtd_dataflash bug
  2009-05-13  1:15 mtd_dataflash bug Tobias Simon
@ 2009-05-13 12:12 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2009-05-13 12:12 UTC (permalink / raw)
  To: Tobias Simon; +Cc: linux-mtd

>>>>> "Tobias" == Tobias Simon <tobias.simon@sp-ss.de> writes:

 Tobias> Hello List,
 Tobias> i have figured out a bug in mtd_datflash.c of kernel 2.6.29, which
 Tobias> causes my ARM bootloader to be killed with every "erase" operation on
 Tobias> arbitrary adresses. The fix is:

Ahh yes, I just sent a patch for the same thing a bit earlier.

This (or my patch) should go to 2.6.29-stable as well.


 Tobias> --- linux-2.6.29.2-a/drivers/mtd/devices/mtd_dataflash.c  2009-05-13
 Tobias> 03:11:16.000000000 +0200
 Tobias> +++ linux-2.6.29.2-b/drivers/mtd/devices/mtd_dataflash.c
 Tobias> 2009-05-13 03:13:30.000000000 +0200
 Tobias> @@ -184,7 +184,7 @@
 Tobias>                /* Calculate flash page address; use block erase (for
 Tobias> speed) if
 Tobias>                 * we're at a block boundary and need to erase the
 Tobias> whole block.
 Tobias>                 */
 Tobias> -               pageaddr = div_u64(instr->len, priv->page_size);
 Tobias> +               pageaddr = div_u64(instr->addr, priv->page_size);
 Tobias>                do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
 Tobias>                pageaddr = pageaddr << priv->page_offset;


-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2009-05-13 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13  1:15 mtd_dataflash bug Tobias Simon
2009-05-13 12:12 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox