summaryrefslogtreecommitdiff
path: root/debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-06-26 15:38:57 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2018-06-26 15:38:57 +0100
commit9421e599c44cd50d3df4cd019cd3c53d9320e93d (patch)
tree2d9606679ad49fbc9f9cf72b3a3a87d7a6dc8fff /debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch
parentec9bfc63255cdf01a67171d1228f562c927c6d36 (diff)
Cherrypick master patches up to 4th of June 2018.debian/4.1_rc1-3archive/debian/4.1_rc1-3
Diffstat (limited to 'debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch')
-rw-r--r--debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch b/debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch
new file mode 100644
index 00000000..d31dde85
--- /dev/null
+++ b/debian/patches/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch
@@ -0,0 +1,32 @@
+From 002a5978f015a77ecc48487006b1030f9dbe1394 Mon Sep 17 00:00:00 2001
+From: Jes Sorensen <jsorensen@fb.com>
+Date: Thu, 31 May 2018 16:07:33 -0400
+Subject: [PATCH 22/26] super-ddf: Fix gcc-8.1 overflow warnings
+
+Cast to types that are big enough to hold the values, but also guarantee
+no overflow of the buffer keepts gcc happy.
+
+Signed-off-by: Jes Sorensen <jsorensen@fb.com>
+---
+ super-ddf.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/super-ddf.c b/super-ddf.c
+index d02a19a2..618542c4 100644
+--- a/super-ddf.c
++++ b/super-ddf.c
+@@ -2881,8 +2881,9 @@ static int add_to_super_ddf(struct supertype *st,
+ dd->disk.magic = DDF_PHYS_DATA_MAGIC;
+ now = time(0);
+ tm = localtime(&now);
+- sprintf(dd->disk.guid, "%8s%04d%02d%02d",
+- T10, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
++ sprintf(dd->disk.guid, "%8s%04d%02d%02d", T10,
++ (__u16)tm->tm_year+1900,
++ (__u8)tm->tm_mon+1, (__u8)tm->tm_mday);
+ tptr = (__u32 *)(dd->disk.guid + 16);
+ *tptr++ = random32();
+ *tptr = random32();
+--
+2.17.1
+