[PATCH mtd-utils] libmtd: don't ignore "region index" parameter in mtd_regioninfo()

Artem Bityutskiy dedekind1 at gmail.com
Tue Sep 16 08:26:22 PDT 2014


On Mon, 2014-09-15 at 10:48 -0700, Brian Norris wrote:
> ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three
> output parameters (info about the erase region). There are two problems
> in mtdinfo/libmtd here:
> 
>  1. mtdinfo.c doesn't initialize its region_info_user struct, instead
>     passing uninitialized data to mtd_regioninfo()
> 
>  2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out
>     the regionindex parameter properly, so the garbage from mtdinfo.c is
>     propagated to the ioctl()

Thanks, I never had flashes with multiple regions so this code path was
probably never tested.

-- 
Best Regards,
Artem Bityutskiy




More information about the linux-mtd mailing list