[PATCH] mtdinfo: don't open NULL pointer when getting region_info with `-a'

Mike Frysinger vapier at gentoo.org
Thu Aug 4 18:36:30 EDT 2011


On Thu, Aug 4, 2011 at 10:47, Brian Norris wrote:
> This "fixes" a regression found in:
>  commit 266061ebd5d72391f0a0e831b018e8fc7fea68a1
>  mtdinfo: add regioninfo/eraseblock map display
>
> On certain flash (NOR flash that have eraseblock region info),
> `mtdinfo -a' tries to open the MTD node file, for use with the ioctl
> MEMGETREGIONINFO; however, we didn't supply a device node path to
> `mtdinfo -a', so it's using NULL, resulting in errors like:
>
>  mtdinfo: error!: couldn't open MTD dev: (null)
>           error 14 (Bad address)
>
> For now, we can just skip dumping region_info with the `-a' flag. If
> we find a better way to do this (e.g., export via sysfs, find device
> nodes via automatic routines, etc.), then we can kill the workaround
> and this FIXME should be removed.

the plan was to fixup the -a behavior once -m was punted.  we need to
rewrite it so that the main logic loops when all is being used and
takes care of constructing the device names via translate_dev.
-mike



More information about the linux-mtd mailing list