dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0012-super-intel-Use-memcpy-to-avoid-confusing-gcc.patch

d922d5
From 167d8bb8302170676f0e15123738e333383fec7b Mon Sep 17 00:00:00 2001
d922d5
From: Jes Sorensen <jsorensen@fb.com>
d922d5
Date: Tue, 29 May 2018 16:09:47 -0400
d922d5
Subject: [RHEL7.5 PATCH 12/26] super-intel: Use memcpy() to avoid confusing
d922d5
 gcc
d922d5
d922d5
When added :0 to serial number and copying it back, use memcpy()
d922d5
instead of strncpy() as we know the actual length. This stops gcc
d922d5
from complaining with -Werror=stringop-truncation enabled
d922d5
d922d5
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
d922d5
---
d922d5
 super-intel.c | 2 +-
d922d5
 1 file changed, 1 insertion(+), 1 deletion(-)
d922d5
d922d5
diff --git a/super-intel.c b/super-intel.c
d922d5
index 449da1d..ec7683d 100644
d922d5
--- a/super-intel.c
d922d5
+++ b/super-intel.c
d922d5
@@ -8098,7 +8098,7 @@ static int mark_failure(struct intel_super *super,
d922d5
 	strcat(buf, ":0");
d922d5
 	if ((len = strlen(buf)) >= MAX_RAID_SERIAL_LEN)
d922d5
 		shift = len - MAX_RAID_SERIAL_LEN + 1;
d922d5
-	strncpy((char *)disk->serial, &buf[shift], MAX_RAID_SERIAL_LEN);
d922d5
+	memcpy(disk->serial, &buf[shift], len + 1 - shift);
d922d5
 
d922d5
 	disk->status |= FAILED_DISK;
d922d5
 	set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD);
d922d5
-- 
d922d5
2.7.4
d922d5