Skip to contentSkip to conversation

LVM2/libdm libdm-deptree.c

PATCH [email protected] 1 participant 1 message Oct 17, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-10-17 14:15:27

Modified files:
libdm : libdm-deptree.c

Log message:
Add _thin_validate_device_id

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.126&r2=1.127

libdm/libdm-deptree.c +13 -5
@@ -2687,6 +2687,17 @@
 	return 1;
 }
 
+static int _thin_validate_device_id(uint32_t device_id)
+{
+	if (device_id > DM_THIN_MAX_DEVICE_ID) {
+		log_error("Device id %u is higher then %u.",
+			  device_id, DM_THIN_MAX_DEVICE_ID);
+		return 0;
+	}
+
+	return 1;
+}
+
 int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
 				      uint64_t size,
 				      uint64_t transaction_id,
@@ -2744,11 +2755,8 @@
 {
 	struct load_segment *seg;
 
-	if (device_id > DM_THIN_MAX_DEVICE_ID) {
-		log_error("Device id %u is higher then %u.",
-			  device_id, DM_THIN_MAX_DEVICE_ID);
-		return 0;
-	}
+	if (!_thin_validate_device_id(device_id))
+		return_0;
 
 	if (!(seg = _add_segment(node, SEG_THIN, size)))
 		return_0;