mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dmstats: check uuid, major, and alldevices before argc (Coverity)
The --uuid, --major and --alldevices arguments were incorrectly tested after confirming argc is > 0, in a branch that only executes if argc == 0 (i.e. they were unreachable). Move all device checks before the test for argc and log an appropriate error before returning.
This commit is contained in:
parent
252952ff33
commit
d2bf6742f8
@ -4978,24 +4978,24 @@ static int _stats_create_file(CMD_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_switches[UUID_ARG] || _switches[MAJOR_ARG]) {
|
||||
log_error("--uuid and --major are incompatible with --filemap.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_switches[ALL_DEVICES_ARG]) {
|
||||
log_error("--alldevices is incompatible with --filemap.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* _stats_create_file does not use _process_all() */
|
||||
if (names || !argc) {
|
||||
if (!argc) {
|
||||
log_error("--filemap requires a file path argument");
|
||||
return 0;
|
||||
} else {
|
||||
if (argc)
|
||||
path = argv[0];
|
||||
else {
|
||||
if (_switches[UUID_ARG] || _switches[MAJOR_ARG])
|
||||
log_error("--uuid and --major are incompatible "
|
||||
"with --filemap.");
|
||||
if (_switches[ALL_DEVICES_ARG])
|
||||
log_error("--alldevices is incompatible with "
|
||||
"--filemap.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
path = argv[0];
|
||||
|
||||
if (_switches[PRECISE_ARG]) {
|
||||
if (!dm_stats_driver_supports_precise()) {
|
||||
log_error("Using --precise requires driver version "
|
||||
|
Loading…
Reference in New Issue
Block a user