master - gcc: avoid stack alloc arithmetic
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fd8d926fc52badc93f7985b5db2f4cb6a75e81e4 Commit: fd8d926fc52badc93f7985b5db2f4cb6a75e81e4 Parent: ce202c3b1c018a001015fa2ff69a01f06d84a6fa Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Aug 28 18:46:06 2020 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Fri Aug 28 21:43:02 2020 +0200
gcc: avoid stack alloc arithmetic
--- tools/lvconvert.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
tools/lvconvert.c +3 -6
@@ -1161,6 +1161,8 @@ static int _lvconvert_validate_thin(struct logical_volume *lv,static int _raid_split_image_conversion (struct logical_volume *lv) {const char *s; +char raidlv_name[NAME_LEN ]; +const struct logical_volume *tmp_lv;if (lv_is_raid_with_tracking (lv)) { log_error("Conversion of tracking raid1 LV %s is not supported.",
@@ -1170,12 +1172,7 @@ static int _raid_split_image_conversion(struct logical_volume *lv)if (lv_is_raid_image (lv) && (s =strstr (lv->name,"_rimage_" ))) { -size_t len = s - lv->name; -char raidlv_name[len +1 ]; -const struct logical_volume *tmp_lv; - -strncpy (raidlv_name, lv->name, len); - raidlv_name[len] ='\0' ; + (void )dm_strncpy (raidlv_name, lv->name, s - lv->name);if (!(tmp_lv =find_lv (lv->vg, raidlv_name))) { log_error(INTERNAL_ERROR "Failed to find RaidLV of RAID subvolume %s.",