]> sourceware.org Git - lvm2.git/commitdiff
Use 64bit unsigned value for maximum stripe size test.
authorMilan Broz <mbroz@redhat.com>
Wed, 2 Mar 2011 16:56:06 +0000 (16:56 +0000)
committerMilan Broz <mbroz@redhat.com>
Wed, 2 Mar 2011 16:56:06 +0000 (16:56 +0000)
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.)

WHATS_NEW
tools/lvresize.c
tools/toollib.c

index e1e5feeb6e087818890ebdefe6121ddfa29a31fb..19cb9ae75437037f811fe0c7758ac5e76263e036 100644 (file)
--- 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.
index 225c4465bb98879c05d17d2e1e8dc52a376192bf..5a9b8fa44f192fb655d467df175b3a5f3c3a4b34 100644 (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;
index cdd8bb7529e1dd4b271955084d38442bf293c790..b9019b8d4079a92ee09b0b2d161e301ca8864e13 100644 (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;
This page took 0.071225 seconds and 5 git commands to generate.