[BUG] mtdinfo -a: Tries to open NULL pointer for NOR with Eraseblock Regions
Brian Norris
computersforpeace at gmail.com
Mon Jul 25 13:10:46 EDT 2011
On Mon, Jul 25, 2011 at 2:48 AM, Brian Foster <brian.foster at maxim-ic.com> wrote:
> Massive apologies if this is not the correct list or
> not the correct way of reporting MTD-utils bugs.
> My searches failed to find anything .... ;-\
This is exactly the right place! Sorry it was difficult to find.
> MTD-utils 1.4.5, when `mtdinfo -a' tries to print the
> eraseblock regions of NOR-Flash, it open(2)s the nil
> pointer (NULL). The problem seems to be in mtdinfo.c's
> print_region_info(), which assumes there is always a MTD
> /dev node name (args.node). However, in the case of `-a',
> args.node is always NULL. Oops!
I don't have a test case that can reproduce the bug, as I don't have
devices with "region info", but I can see the problem fairly clearly.
It seems that the basic issue we need to solve is how to find the
correct file devfs/udev path for a device using only its mtd_info
object (e.g., use its major/minor number?). Then we could fix this
line in print_region_info() for cases where args.node == NULL:
fd = open(args.node, O_RDONLY | O_CLOEXEC);
Also, is "region_info" a potential candidate for exporting via sysfs?
That would make this support easier to include in libmtd.
Brian
More information about the linux-mtd
mailing list