diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2022-06-22 22:25:12 +0200 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2022-08-07 22:27:59 +0200 |
commit | 41edf6f45895193f4a523cb0a08d639c9ff9ccc9 (patch) | |
tree | d6085adb5953d79b4b546152ebcced5c0740fce5 /mdadm.c | |
parent | mdadm: Fix mdadm -r remove option regression (diff) | |
download | mdadm-41edf6f45895193f4a523cb0a08d639c9ff9ccc9.tar.xz mdadm-41edf6f45895193f4a523cb0a08d639c9ff9ccc9.zip |
mdadm: Fix optional --write-behind parameter
The commit noted below changed the behaviour of --write-behind to
require an argument. This broke the 06wrmostly test with the error:
mdadm: Invalid value for maximum outstanding write-behind writes: (null).
Must be between 0 and 16383.
To fix this, check if optarg is NULL before parising it, as the origial
code did.
Fixes: 60815698c0ac ("Refactor parse_num and use it to parse optarg.")
Cc: Mateusz Grzonka <mateusz.grzonka@intel.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1201,8 +1201,9 @@ int main(int argc, char *argv[]) case O(BUILD, WriteBehind): case O(CREATE, WriteBehind): s.write_behind = DEFAULT_MAX_WRITE_BEHIND; - if (parse_num(&s.write_behind, optarg) != 0 || - s.write_behind < 0 || s.write_behind > 16383) { + if (optarg && + (parse_num(&s.write_behind, optarg) != 0 || + s.write_behind < 0 || s.write_behind > 16383)) { pr_err("Invalid value for maximum outstanding write-behind writes: %s.\n\tMust be between 0 and 16383.\n", optarg); exit(2); |