[PATCH 2/2] ubinfo: fix `--all' for non-consecutive device numbers

Brian Norris computersforpeace at gmail.com
Fri Jan 27 13:28:59 EST 2012


On Thu, Jan 26, 2012 at 12:53 AM, Brian Foster
<brian.foster at maxim-ic.com> wrote:
> On Thursday 26 January 2012 08:31:50 Brian Norris wrote:
>> When we have assigned non-consecutive device numbers to our UBI devices [...]
>> This patch adds a check to first see if device is present, then continue
>> to the next ID if it doesn't exist.
>>[ ... ]
>
>  Looks Ok to me (when used with part 1).
>
>  However, looking at the mtd-utils v1.4.6 ‘mtdinfo.c’,
>  is there a similar issue there?  But I have no idea
>  how you could get non-consecutive MTD device numbers?

Yeah, there is a problem there. It's a little more difficult to see,
but it can happen.

Suppose you have /dev/mtd0 on your system, then you can get an error
with the following sequence:

# modprobe mtdram
# modprobe nandsim
# rmmod mtdram
# mtdinfo --all
...
mtdinfo: error!: mtd1 does not correspond to any existing MTD device

I'm sending a quick patch set for this.

Brian



More information about the linux-mtd mailing list