1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

pool: validate sizes

0 size are not supported as well as negative.
This commit is contained in:
Zdenek Kabelac 2014-10-31 11:41:49 +01:00
parent dc11dcf11d
commit 897b091579

View File

@ -975,12 +975,21 @@ int get_pool_params(struct cmd_context *cmd,
} }
} }
if (arg_count(cmd, chunksize_ARG)) { if (arg_from_list_is_negative(cmd, "may not be negative",
if (arg_sign_value(cmd, chunksize_ARG, SIGN_NONE) == SIGN_MINUS) { chunksize_ARG,
log_error("Negative chunk size is invalid."); pooldatasize_ARG,
return 0; poolmetadatasize_ARG,
} -1))
return_0;
if (arg_from_list_is_zero(cmd, "may not be zero",
chunksize_ARG,
pooldatasize_ARG,
poolmetadatasize_ARG,
-1))
return_0;
if (arg_is_set(cmd, chunksize_ARG)) {
*passed_args |= PASS_ARG_CHUNK_SIZE; *passed_args |= PASS_ARG_CHUNK_SIZE;
*chunk_size = arg_uint_value(cmd, chunksize_ARG, 0); *chunk_size = arg_uint_value(cmd, chunksize_ARG, 0);