[BUG] mtdinfo -a: Tries to open NULL pointer for NOR with Eraseblock Regions

Brian Norris computersforpeace at gmail.com
Mon Aug 8 19:19:11 EDT 2011


On Fri, Aug 5, 2011 at 6:18 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Fri, Aug 5, 2011 at 17:09, Brian Norris wrote:
>> On Thu, Aug 4, 2011 at 3:41 PM, Mike Frysinger wrote:
>>> when extending mtdinfo, we decided to only support device paths which
>>> the user gave us.  hence the -m option going away.  libmtd itself has
>>> /dev/mtd# hardcoded (and imo, that's the only path we should support
>>> "automatically"), so if we're going to keep the all option, we'll want
>>> to continue with that (by using the func that libmtd provides rather
>>> than mtdinfo constructing the string itself).
>>
>> Hmm, where exactly in mtd-utils/libmtd is the /dev/mtd# hardcoded?
>
> i was thinking of legacy_get_dev_info1()

I'm not sure we should be reaching back to legacy options for current
support. Besides, I see in the feature-removal messages that were
placed for the removal of the `-m' option to mtdinfo (commit
74bef2b8693c7e4f78e1ef742933b7231e49c7ad to mtd-utils):

"We cannot assume that mtd device names follow the "/dev/mtd%d" pattern"

It seems silly to reverse this just for the sake of some region_info stuff.

> alternatively, we punt --all and just make users run `mtdinfo
> /dev/mtd?`.  i'm fine with that too.

I also feel like `--all' is too valuable to be killed just because of
region_info.

Instead, I'm a little more inclined to go for Brian Foster's
suggestion (from another branch of this thread):

"Alternatively, --all only prints what it can get,
and --help warns there _may_ be additional data not
printed by --all (and to use ‘mtdinfo /dev/mtd<N>’)."

Only problem I see is that this provides a little bit of
inconsistency, where `mtdinfo --all' isn't quite all the info. But
with an addition help message as described by Mr. Foster, I don't
think this would be much problem.

I guess I'm leaning toward this suggestion partly because it is
effectively the same as my proposed patch and partly because the other
alternatives involve dropping support for features (either full udev
support or the `--all' option).

Brian



More information about the linux-mtd mailing list