From: Aaron Marcher Date: Tue, 8 Aug 2017 10:53:27 +0000 (+0200) Subject: mtd-utils: ubinfo: add parameter check X-Git-Tag: v2.0.1~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=76a55b190c3b15f512c1daf5976249b38db916d6;p=mtd-utils.git mtd-utils: ubinfo: add parameter check Adds a check if the UBI device number is specified when passing a volume name as parameter. This fixes an issue, where by default an inexistent UBI device named "ubi-1" is selected because of missing checks. Signed-off-by: Aaron Marcher Signed-off-by: David Oberhollenzer --- diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c index 82d4f18..29530be 100644 --- a/ubi-utils/ubinfo.c +++ b/ubi-utils/ubinfo.c @@ -399,6 +399,12 @@ int main(int argc, char * const argv[]) goto out_libubi; } + if (args.vol_name && args.devn == -1) { + errmsg("volume name is specified, but UBI device number is not " + "(use -h for help)\n"); + goto out_libubi; + } + if (args.vol_name) { err = get_vol_id_by_name(libubi, args.devn, args.vol_name); if (err)