From 9421e599c44cd50d3df4cd019cd3c53d9320e93d Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 26 Jun 2018 15:38:57 +0100 Subject: Cherrypick master patches up to 4th of June 2018. --- ...-Do-not-truncate-last-character-of-volume.patch | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch (limited to 'debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch') diff --git a/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch b/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch new file mode 100644 index 00000000..d3b621a3 --- /dev/null +++ b/debian/patches/0015-super-intel-Do-not-truncate-last-character-of-volume.patch @@ -0,0 +1,37 @@ +From ebad3af29b401dec7203e8fa5a77bcf16532f49c Mon Sep 17 00:00:00 2001 +From: Jes Sorensen +Date: Wed, 30 May 2018 12:10:13 -0400 +Subject: [PATCH 15/26] super-intel: Do not truncate last character of volume + name + +Clear up strncpy abuse to avoid gcc-8.1 complaining about truncating +the string. + +Signed-off-by: Jes Sorensen +--- + super-intel.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/super-intel.c b/super-intel.c +index 520d2921..aa93a9e9 100644 +--- a/super-intel.c ++++ b/super-intel.c +@@ -7587,11 +7587,12 @@ static int update_subarray_imsm(struct supertype *st, char *subarray, + append_metadata_update(st, u, sizeof(*u)); + } else { + struct imsm_dev *dev; +- int i; ++ int i, namelen; + + dev = get_imsm_dev(super, vol); +- strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN); +- dev->volume[MAX_RAID_SERIAL_LEN-1] = '\0'; ++ memset(dev->volume, '\0', MAX_RAID_SERIAL_LEN); ++ namelen = min((int)strlen(name), MAX_RAID_SERIAL_LEN); ++ memcpy(dev->volume, name, namelen); + for (i = 0; i < mpb->num_raid_devs; i++) { + dev = get_imsm_dev(super, i); + handle_missing(super, dev); +-- +2.17.1 + -- cgit v1.2.3