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

gcc: avoid stack alloc arithmetic

This commit is contained in:
Zdenek Kabelac 2020-08-28 18:46:06 +02:00
parent 90a9a7785e
commit d48266b7fb

View File

@ -1173,6 +1173,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.",
@ -1182,12 +1184,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.",