summaryrefslogtreecommitdiff
path: root/debian/patches/0011-Do-not-confuse-gcc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0011-Do-not-confuse-gcc.patch')
-rw-r--r--debian/patches/0011-Do-not-confuse-gcc.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/debian/patches/0011-Do-not-confuse-gcc.patch b/debian/patches/0011-Do-not-confuse-gcc.patch
new file mode 100644
index 00000000..e0795cf8
--- /dev/null
+++ b/debian/patches/0011-Do-not-confuse-gcc.patch
@@ -0,0 +1,42 @@
+From 760365f94409ccccbcb54d55070f0f422bee44a1 Mon Sep 17 00:00:00 2001
+From: Jes Sorensen <jsorensen@fb.com>
+Date: Tue, 29 May 2018 15:52:48 -0400
+Subject: [PATCH 11/26] Do not confuse gcc
+
+gcc-8.1's -Werror=stringop-truncation is easily confused. Rather than
+disabling the check, make it explicit we are OK truncating here.
+
+Signed-off-by: Jes Sorensen <jsorensen@fb.com>
+---
+ super-intel.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/super-intel.c b/super-intel.c
+index ce08af47..449da1dd 100644
+--- a/super-intel.c
++++ b/super-intel.c
+@@ -5323,6 +5323,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
+ struct imsm_map *map;
+ int idx = mpb->num_raid_devs;
+ int i;
++ int namelen;
+ unsigned long long array_blocks;
+ size_t size_old, size_new;
+ unsigned long long num_data_stripes;
+@@ -5402,7 +5403,12 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
+ return 0;
+ dv = xmalloc(sizeof(*dv));
+ dev = xcalloc(1, sizeof(*dev) + sizeof(__u32) * (info->raid_disks - 1));
+- strncpy((char *) dev->volume, name, MAX_RAID_SERIAL_LEN);
++ /*
++ * Explicitly allow truncating to not confuse gcc's
++ * -Werror=stringop-truncation
++ */
++ namelen = min((int) strlen(name), MAX_RAID_SERIAL_LEN);
++ memcpy(dev->volume, name, namelen);
+ array_blocks = calc_array_size(info->level, info->raid_disks,
+ info->layout, info->chunk_size,
+ s->size * BLOCKS_PER_KB);
+--
+2.17.1
+