1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-06 10:00:40 +03:00

cov: annotate known use of validated lv name

This commit is contained in:
Zdenek Kabelac 2024-05-27 13:24:06 +02:00
parent 1b90865843
commit 403ecb46fa
6 changed files with 7 additions and 2 deletions

View File

@ -420,7 +420,7 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_CACHE)))
return_NULL;
/* coverity[format_string_injection] lv name is already validated */
if (!insert_layer_for_lv(cmd, cache_lv, 0, "_corig"))
return_NULL;

View File

@ -678,6 +678,7 @@ int lv_add_integrity_to_raid(struct logical_volume *lv, struct integrity_setting
* but gets a new integrity segment, in place of the segments
* that were moved to lv_iorig.
*/
/* coverity[format_string_injection] lv name is already validated */
if (!insert_layer_for_lv(cmd, lv_image, 0, "_iorig"))
goto_bad;

View File

@ -676,7 +676,7 @@ static int _split_mirror_images(struct logical_volume *lv,
* A number of images have been split and
* a new mirror layer must be formed
*/
/* coverity[format_string_injection] lv name is already validated */
if (!insert_layer_for_lv(cmd, new_lv, 0, "_mimage_%d")) {
log_error("Failed to build new mirror, %s.",
display_lvname(new_lv));
@ -1604,6 +1604,7 @@ static struct logical_volume *_set_up_mirror_log(struct cmd_context *cmd,
suffix = "_mlog";
}
/* coverity[format_string_injection] lv name is already validated */
if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv_name, suffix))) {
log_error("Failed to create mirror log.");
return NULL;

View File

@ -794,6 +794,7 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents,
lv->le_count, extents);
/* Check spare LV is big enough and preserve segtype */
if ((lv->le_count < extents) && seg &&
/* coverity[format_string_injection] lv name is already validated */
!lv_extend(lv, seg->segtype,
seg->area_count / seg_mirrors,
seg->stripe_size,

View File

@ -432,6 +432,7 @@ int convert_vdo_pool_lv(struct logical_volume *data_lv,
*virtual_extents = vdo_logical_size / extent_size;
/* Move segments from existing data_lv into LV_vdata */
/* coverity[format_string_injection] lv name is already validated */
if (!(data_lv = insert_layer_for_lv(cmd, vdo_pool_lv, 0, "_vdata")))
return_0;

View File

@ -3448,6 +3448,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
* moved to pool_lv by _lvconvert_insert_thin_layer, and now is
* moved to data_lv.)
*/
/* coverity[format_string_injection] lv name is already validated */
if (!(data_lv = insert_layer_for_lv(cmd, pool_lv, 0,
(to_cachepool ? "_cdata" : "_tdata"))))
goto_bad;