Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/lvcreate.c

PATCH [email protected] 1 participant 1 message Mar 1, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-03-01 21:21:55

Modified files:
. : WHATS_NEW
tools : lvcreate.c

Log message:
Check for alloc error

Simplify segtype_str usage and check for NULL segtype.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2330&r2=1.2331
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.257&r2=1.258

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.94 - 
 ====================================
+  Check for alloc fail from get_segtype_from_string() in _lvcreate_params().
   Add _rimage as reserved suffix to lvm.8 man page.
   Improve error logging from mpath filter.
   Check for allocation failure in hold_lock() in clvmd.
tools/lvcreate.c +5 -2
@@ -652,10 +652,13 @@
 	else
 		segtype_str = "striped";
 
-	lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, segtype_str));
+	segtype_str = arg_str_value(cmd, type_ARG, segtype_str);
+
+	if (!(lp->segtype = get_segtype_from_string(cmd, segtype_str)))
+		return_0;
 
 	if (seg_unknown(lp)) {
-		log_error("Unable to create LV with unknown segment type %s.", arg_str_value(cmd, type_ARG, segtype_str));
+		log_error("Unable to create LV with unknown segment type %s.", segtype_str);
 		return 0;
 	}