Blame SOURCES/0022-super-ddf-Fix-gcc-8.1-overflow-warnings.patch

d922d5
From 002a5978f015a77ecc48487006b1030f9dbe1394 Mon Sep 17 00:00:00 2001
d922d5
From: Jes Sorensen <jsorensen@fb.com>
d922d5
Date: Thu, 31 May 2018 16:07:33 -0400
d922d5
Subject: [RHEL7.5 PATCH 22/26] super-ddf: Fix gcc-8.1 overflow warnings
d922d5
d922d5
Cast to types that are big enough to hold the values, but also guarantee
d922d5
no overflow of the buffer keepts gcc happy.
d922d5
d922d5
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
d922d5
---
d922d5
 super-ddf.c | 5 +++--
d922d5
 1 file changed, 3 insertions(+), 2 deletions(-)
d922d5
d922d5
diff --git a/super-ddf.c b/super-ddf.c
d922d5
index d02a19a..618542c 100644
d922d5
--- a/super-ddf.c
d922d5
+++ b/super-ddf.c
d922d5
@@ -2881,8 +2881,9 @@ static int add_to_super_ddf(struct supertype *st,
d922d5
 	dd->disk.magic = DDF_PHYS_DATA_MAGIC;
d922d5
 	now = time(0);
d922d5
 	tm = localtime(&now;;
d922d5
-	sprintf(dd->disk.guid, "%8s%04d%02d%02d",
d922d5
-		T10, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
d922d5
+	sprintf(dd->disk.guid, "%8s%04d%02d%02d", T10,
d922d5
+		(__u16)tm->tm_year+1900,
d922d5
+		(__u8)tm->tm_mon+1, (__u8)tm->tm_mday);
d922d5
 	tptr = (__u32 *)(dd->disk.guid + 16);
d922d5
 	*tptr++ = random32();
d922d5
 	*tptr = random32();
d922d5
-- 
d922d5
2.7.4
d922d5