This is the mail archive of the lvm2-cvs@sourceware.org mailing list for the LVM2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LVM2/libdm libdm-deptree.c


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@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

--- LVM2/libdm/libdm-deptree.c	2011/10/17 14:15:01	1.126
+++ LVM2/libdm/libdm-deptree.c	2011/10/17 14:15:26	1.127
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]