From 76a55b190c3b15f512c1daf5976249b38db916d6 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Tue, 8 Aug 2017 12:53:27 +0200 Subject: 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 --- ubi-utils/ubinfo.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ubi-utils') 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) -- cgit v1.2.3