]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super0: Use memmove() when adjusting sparc2.2 superblock data
authorJes Sorensen <jsorensen@fb.com>
Thu, 31 May 2018 17:17:46 +0000 (13:17 -0400)
committerJes Sorensen <jsorensen@fb.com>
Thu, 31 May 2018 17:19:57 +0000 (13:19 -0400)
memcpy() does not allow overlapping copies, switch to memmove()

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super0.c

index 756cab5e9d009347090677dce6b72bad1ce7ece0..42989b9f66eb62ea4a25b25a5fbfd9c89c0a3568 100644 (file)
--- 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);