Mask error in nandbase.c: nand_scan(): oob_size

Nathan H. n_8_10 at hotmail.com
Wed Aug 3 17:35:51 EDT 2005


I noticed an error in nandbase.c file.  The nand_scan() function in 
calculates the oob_size:

Line 2372:
/* Calc oobsize */
mtd->oobsize = (8 << (extid & 0x03)) * (mtd->oobblock / 512);
                                                      ^error

The mask used allows for the lowest 2 bits to pass.  But this is supposed to 
be a single bit field.  This error has not caused any problems because the 
next highest bit is reserved for now (always zero).  However it could cause 
a problem in the future.

The code line should be:
mtd->oobsize = (8 << (extid & 0x01)) * (mtd->oobblock / 512);
                                                       ^fix

Reference:  Page 31 (Table: 4th ID Data)
http://www.samsung.com/Products/Semiconductor/Flash/NAND/2Gbit/K9F2G08U0M/ds_k9f2gxxu0m_rev10.pdf

-Nathan






More information about the linux-mtd mailing list