Commit 2cf2f0d5 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jason Wessel

kdb: use memmove instead of overlapping memcpy

gcc discovered that the memcpy() arguments in kdbnearsym() overlap, so
we should really use memmove(), which is defined to handle that correctly:

In function 'memcpy',
    inlined from 'kdbnearsym' at /git/arm-soc/kernel/debug/kdb/kdb_support.c:132:4:
/git/arm-soc/include/linux/string.h:353:9: error: '__builtin_memcpy' accessing 792 bytes at offsets 0 and 8 overlaps 784 bytes at offset 8 [-Werror=restrict]
  return __builtin_memcpy(p, q, size);
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent 40b90efe
...@@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) ...@@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab)
} }
if (i >= ARRAY_SIZE(kdb_name_table)) { if (i >= ARRAY_SIZE(kdb_name_table)) {
debug_kfree(kdb_name_table[0]); debug_kfree(kdb_name_table[0]);
memcpy(kdb_name_table, kdb_name_table+1, memmove(kdb_name_table, kdb_name_table+1,
sizeof(kdb_name_table[0]) * sizeof(kdb_name_table[0]) *
(ARRAY_SIZE(kdb_name_table)-1)); (ARRAY_SIZE(kdb_name_table)-1));
} else { } else {
debug_kfree(knt1); debug_kfree(knt1);
knt1 = kdb_name_table[i]; knt1 = kdb_name_table[i];
memcpy(kdb_name_table+i, kdb_name_table+i+1, memmove(kdb_name_table+i, kdb_name_table+i+1,
sizeof(kdb_name_table[0]) * sizeof(kdb_name_table[0]) *
(ARRAY_SIZE(kdb_name_table)-i-1)); (ARRAY_SIZE(kdb_name_table)-i-1));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment