1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Use 64bit unsigned value for maximum stripe size test.

While STRIPE_SIZE_LIMIT * 2 is basically UINT_MAX, 32bit integer
value can already overflow durin arg size parsing.

(This really happens in test where --stripesize 4294967291 is used,
in s390x uint overflow and this test is ineffective.)
This commit is contained in:
Milan Broz 2011-03-02 16:56:06 +00:00
parent 0263cd7bbc
commit 301c2b8822
3 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.85 -
===================================
Fix possible overwlow in maximum stripe size.
Add test for failed allocation from dm_task_set_uuid() in dmeventd.
Improve pvremove error message when PV belongs to a VG.
Extend normal policy to allow mirror logs on same PVs as images if necessary.

View File

@ -55,7 +55,7 @@ static int _validate_stripesize(struct cmd_context *cmd,
return 0;
}
if (arg_uint_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT * 2) {
if (arg_uint64_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT * 2) {
log_error("Stripe size cannot be larger than %s",
display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
return 0;

View File

@ -1541,7 +1541,7 @@ int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes, uint32_t *stri
return 0;
}
if(*stripe_size > STRIPE_SIZE_LIMIT * 2) {
if(arg_uint64_value(cmd, stripesize_ARG, 0) > STRIPE_SIZE_LIMIT * 2) {
log_error("Stripe size cannot be larger than %s",
display_size(cmd, (uint64_t) STRIPE_SIZE_LIMIT));
return 0;