summaryrefslogtreecommitdiff
path: root/debian/patches/0020-super0-Use-memmove-when-adjusting-sparc2.2-superbloc.patch
blob: 776434eca3173236f05da5f1311c415cb14757ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 2dcd6492718c2921feac993aa71ed3a7c2522077 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <jsorensen@fb.com>
Date: Thu, 31 May 2018 13:17:46 -0400
Subject: [PATCH 20/26] super0: Use memmove() when adjusting sparc2.2
 superblock data

memcpy() does not allow overlapping copies, switch to memmove()

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
 super0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/super0.c b/super0.c
index 756cab5e..42989b9f 100644
--- a/super0.c
+++ b/super0.c
@@ -520,9 +520,10 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
 		 * up 4 bytes before continuing
 		 */
 		__u32 *sb32 = (__u32*)sb;
-		memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-		       sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-		       (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
+
+		memmove(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
+			sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
+			(MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
 		if (verbose >= 0)
 			pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n",
 			       devname);
-- 
2.17.1