From: Chen Gang <gang.chen@asianux.com>
To: jason.wessel@windriver.com
Cc: kgdb-bugreport@lists.sourceforge.net,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel: debug: memcpy overlaped, use memmove instead of memcpy.
Date: Wed, 17 Apr 2013 17:42:48 +0800 [thread overview]
Message-ID: <516E6E98.4010501@asianux.com> (raw)
In-Reply-To: <51614951.80606@asianux.com>
Hello maintainers:
please help check this patch, when you have time, thanks.
On 2013年04月07日 18:24, Chen Gang wrote:
>
> in memcpy, src and dest are overlaped.
> for default implementaion or some architectures, it is OK.
> but we can not be sure that it is OK for all platforms.
> and in this condition, the performance are not quite important.
>
> so better to use standard ways: let memmove instead of memcpy.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> kernel/debug/kdb/kdb_support.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
> index d35cc2d..990b3cc 100644
> --- a/kernel/debug/kdb/kdb_support.c
> +++ b/kernel/debug/kdb/kdb_support.c
> @@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab)
> }
> if (i >= ARRAY_SIZE(kdb_name_table)) {
> 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]) *
> (ARRAY_SIZE(kdb_name_table)-1));
> } else {
> debug_kfree(knt1);
> 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]) *
> (ARRAY_SIZE(kdb_name_table)-i-1));
> }
>
--
Chen Gang
Asianux Corporation
prev parent reply other threads:[~2013-04-17 9:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-07 10:24 [PATCH] kernel: debug: memcpy overlaped, use memmove instead of memcpy Chen Gang
2013-04-17 9:42 ` Chen Gang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516E6E98.4010501@asianux.com \
--to=gang.chen@asianux.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox