[BUG] mtdinfo -a: Tries to open NULL pointer for NOR with Eraseblock Regions
Brian Foster
brian.foster at maxim-ic.com
Mon Aug 8 04:40:07 EDT 2011
On Monday 08 August 2011 10:10:42 Brian Foster wrote:
>[...] (And yes, case ‘(2)’ really is
> only 4MiB — that chip is almost useless for
> the Linux systems.... ;-\ That system also
> has a 2nd NOR-Flash (32MiB), but I don't have
> at-hand the ‘mtd_debug info’ for it....)
Have it now ....
────────────────────────────────────────────────
# mtd_debug info /dev/mtd1 #(3) 2nd Flash on the 2nd system
mtd.type = MTD_NORFLASH
mtd.flags = MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_POWERUP_LOCK
mtd.size = 33423360 (31M)
mtd.erasesize = 131072 (128K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 2
region[0].offset = 0x00000000
region[0].erasesize = 32768 (32K)
region[0].numblocks = 4
region[0].regionindex = 0
region[1].offset = 0x00020000
region[1].erasesize = 131072 (128K)
region[1].numblocks = 255
region[1].regionindex = 1
────────────────────────────────────────────────
Upshot is I've got three different cases:
Case (1) has one region, case (2) has three regions,
and case (3) has two regions. All three, as predicted,
cause the ‘mtdinfo -a’ open(2)-NULL bug. And, AFAIK,
all three NOR chips use CFI. Some quick searching
suggests CFI _requires_ at least one region.
It also appears to be the case MTD reports a non-0
number of regions only(?) for not-partitioned Flashes;
that is, when ‘/dev/mtd<N>’ is the entire chip (not a
partition of a chip). This is based on observation,
not a reading of the code nor the documentation, so
could very easily be wrong! But, if CFI does require
at least one region and I'm not too badly wrong, this
may explain why others have problems reproducing the
issue: The tests use partitions, not whole-chips?
cheers!
-blf-
--
Brian FOSTER
Principal MTS, Software
Maxim Integrated Products (Microcontroller BU), formerly Innova Card
Web : http://www.maxim-ic.com/
More information about the linux-mtd
mailing list