dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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