[PATCH] nand_default_block_markbad fix

Artem B. Bityuckiy dedekind at infradead.org
Tue Feb 8 07:02:04 EST 2005


Hello, here is small bugfix.

Bug description: kernel oops if there is no BBT table and the 
nand_default_block_markbad() function is called.

The patch should be applied to the drivers/mtd/nand/nand_base.c file.

Ok to commit?

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
-------------- next part --------------
--- nand_base.c	2005-02-08 14:54:03.330897219 +0300
+++ nand_base_fixed.c	2005-02-08 14:52:44.330376104 +0300
@@ -461,7 +461,8 @@
 	
 	/* Get block number */
 	block = ((int) ofs) >> this->bbt_erase_shift;
-	this->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
+	if (this->bbt)
+		this->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
 
 	/* Do we have a flash based bad block table ? */
 	if (this->options & NAND_USE_FLASH_BBT)


More information about the linux-mtd mailing list