1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Add _thin_validate_device_id

This commit is contained in:
Zdenek Kabelac 2011-10-17 14:15:26 +00:00
parent 5668fd6a7a
commit 5668fe04d9

View File

@ -2687,6 +2687,17 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
return 1; 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, int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
uint64_t size, uint64_t size,
uint64_t transaction_id, uint64_t transaction_id,
@ -2744,11 +2755,8 @@ int dm_tree_node_add_thin_target(struct dm_tree_node *node,
{ {
struct load_segment *seg; struct load_segment *seg;
if (device_id > DM_THIN_MAX_DEVICE_ID) { if (!_thin_validate_device_id(device_id))
log_error("Device id %u is higher then %u.", return_0;
device_id, DM_THIN_MAX_DEVICE_ID);
return 0;
}
if (!(seg = _add_segment(node, SEG_THIN, size))) if (!(seg = _add_segment(node, SEG_THIN, size)))
return_0; return_0;