Skip to contentSkip to conversation

LVM2/lib/metadata lv_manip.c

PATCH [email protected] 1 participant 1 message Feb 28, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-02-28 10:08:20

Modified files:
lib/metadata : lv_manip.c

Log message:
Explicitely check list size of segments

instead of checking for NULL from last_seg and first_seg.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.366&r2=1.367

lib/metadata/lv_manip.c +3 -2
@@ -2093,7 +2093,8 @@
 		}
 	}
 
-	if ((seg = last_seg(lv)) && (seg->segtype == segtype)) {
+	if (!dm_list_empty(&lv->segments) &&
+	    (seg = last_seg(lv)) && (seg->segtype == segtype)) {
 		seg->area_len += extents;
 		seg->len += extents;
 	} else {
@@ -2411,7 +2412,7 @@
 	char img_name[len];
 	struct lv_segment *mapseg;
 
-	if (lv->le_count || first_seg(lv)) {
+	if (lv->le_count || !dm_list_empty(&lv->segments)) {
 		log_error(INTERNAL_ERROR
 			  "Non-empty LV passed to _lv_insert_empty_sublv");
 		return 0;