Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/lvresize.c tools/toollib.c

PATCH [email protected] 1 participant 1 message Mar 2, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2011-03-02 16:56:07

Modified files:
. : WHATS_NEW
tools : lvresize.c toollib.c

Log message:
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.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1931&r2=1.1932
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.128&r2=1.129
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.222&r2=1.223

WHATS_NEW +1 -0
@@ -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.
tools/lvresize.c +1 -1
@@ -55,7 +55,7 @@
 		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;
tools/toollib.c +1 -1
@@ -1541,7 +1541,7 @@
 			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;