From: Milan Broz Date: Wed, 2 Mar 2011 16:56:06 +0000 (+0000) Subject: Use 64bit unsigned value for maximum stripe size test. X-Git-Tag: v2_02_91~1033 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=301c2b8822f212c2dba462dd7390bbab03ebc823;p=lvm2.git 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.) --- diff --git a/WHATS_NEW b/WHATS_NEW index e1e5feeb6..19cb9ae75 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -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. diff --git a/tools/lvresize.c b/tools/lvresize.c index 225c4465b..5a9b8fa44 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -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; diff --git a/tools/toollib.c b/tools/toollib.c index cdd8bb752..b9019b8d4 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -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;