linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* nand_update_bbt fix
@ 2009-08-10 23:04 Andrew McKay
  2009-08-11 15:39 ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew McKay @ 2009-08-10 23:04 UTC (permalink / raw)
  To: linux-mtd

Hello,

For NAND parts with 2K pages or larger, kmalloc of one erase block will exceed 
128K and fail.  A vmalloc is used in nand_scan_bbt to allocate enough memory for 
one erase block.  This should likely be the case for nand_update_bbt as well.

Not sure the proper way to submit a patch, but here's a diff of the change:

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 55c23e5..43b8d08 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1030,7 +1030,7 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
   /* Allocate a temporary buffer for one eraseblock incl. oob */
   len = (1 << this->bbt_erase_shift);
   len += (len >> this->page_shift) * mtd->oobsize;
- buf = kmalloc(len, GFP_KERNEL);
+ buf = vmalloc(len);
   if (!buf) {
     printk(KERN_ERR "nand_update_bbt: Out of memory\n");
     return -ENOMEM;
@@ -1063,7 +1063,7 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
   }

   out:
- kfree(buf);
+ vfree(buf);
   return res;
  }

Andrew McKay
Iders Inc.

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

end of thread, other threads:[~2009-08-13  8:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10 23:04 nand_update_bbt fix Andrew McKay
2009-08-11 15:39 ` Artem Bityutskiy
2009-08-11 16:03   ` Andrew McKay
2009-08-12  5:51     ` Artem Bityutskiy
2009-08-12 17:37       ` David Brownell
2009-08-13  5:48         ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).