dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0014-super-intel-Avoid-gcc-8.1-complaining-about-truncati.patch

59ea72
From 40659392ff90fc9c2861ec18c34ed1bdb54f92ca Mon Sep 17 00:00:00 2001
59ea72
From: Jes Sorensen <jsorensen@fb.com>
59ea72
Date: Wed, 30 May 2018 11:56:37 -0400
59ea72
Subject: [RHEL7.5 PATCH 14/26] super-intel: Avoid gcc-8.1 complaining about
59ea72
 truncating snprintf()
59ea72
59ea72
We know the max size of the volume name, so no need to play the
59ea72
snprintf() game.
59ea72
59ea72
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
59ea72
---
59ea72
 super-intel.c | 3 ++-
59ea72
 1 file changed, 2 insertions(+), 1 deletion(-)
59ea72
59ea72
diff --git a/super-intel.c b/super-intel.c
59ea72
index cc53f0f..520d292 100644
59ea72
--- a/super-intel.c
59ea72
+++ b/super-intel.c
59ea72
@@ -9881,6 +9881,7 @@ static void imsm_process_update(struct supertype *st,
59ea72
 		/* sanity check that we are not affecting the uuid of
59ea72
 		 * an active array
59ea72
 		 */
59ea72
+		memset(name, 0, sizeof(name));
59ea72
 		snprintf(name, MAX_RAID_SERIAL_LEN, "%s", (char *) u->name);
59ea72
 		name[MAX_RAID_SERIAL_LEN] = '\0';
59ea72
 		for (a = st->arrays; a; a = a->next)
59ea72
@@ -9892,7 +9893,7 @@ static void imsm_process_update(struct supertype *st,
59ea72
 			break;
59ea72
 		}
59ea72
 
59ea72
-		snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
59ea72
+		memcpy(dev->volume, name, MAX_RAID_SERIAL_LEN);
59ea72
 		super->updates_pending++;
59ea72
 		break;
59ea72
 	}
59ea72
-- 
59ea72
2.7.4
59ea72