Skip to contentSkip to conversation

NAND: Initialization of Bad Block Pattern

PATCH New Konstantin Baydarov 1 participant 1 message Nov 22, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NAND: Initialization of Bad Block Pattern

Second try. This patch correctly initialize badblock_pattern in case NAND_IS_AND. Currently badblock_pattern is uninitialized and if someone try to use it NULL pointer dereference will happen.

drivers/mtd/nand/nand_bbt.c +2 -1
Index: linux-2.6.18/drivers/mtd/nand/nand_bbt.c
===================================================================
@@ -1165,7 +1165,8 @@ int nand_default_bbt(struct mtd_info *mt
 			this->bbt_md = &bbt_mirror_descr;
 		}
 		this->options |= NAND_USE_FLASH_BBT;
-		return nand_scan_bbt(mtd, &agand_flashbased);
+		this->badblock_pattern = &agand_flashbased;
+		return nand_scan_bbt(mtd, this->badblock_pattern);
 	}
 
 	/* Is a flash based bad block table requested ? */