From 5e72757bd619cd6f9422b6b342f52ff8bd3ffb21 Mon Sep 17 00:00:00 2001
From: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Date: Fri, 6 Nov 2015 15:50:46 +0100
Subject: [PATCH] powerpc/module: avoid memmove() in dedotify()

memmove() is essentially a memcpy() on powerpc64. dedotify() does
a memmove() to remove the leading dot from undefined symbol names
it is simply more efficient to offset st_name and arguably more
correct (other ELF objects could be pointing to this string). At
some point, a correct memmove() implementation is needed for power
(especially for cases like this where the source and destination
overlap). There are indeed other memmove() calls in the kernel...

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 arch/powerpc/kernel/module_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 6838451..e77dbae 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -335,7 +335,7 @@ static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
 		if (syms[i].st_shndx == SHN_UNDEF) {
 			char *name = strtab + syms[i].st_name;
 			if (name[0] == '.')
-				memmove(name, name+1, strlen(name));
+				syms[i].st_name++;
 		}
 	}
 }
-- 
1.9.1

