mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
	<kgdb-bugreport@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kdb: use memmove instead of overlapping memcpy
Date: Fri, 2 Feb 2018 09:08:40 -0600	[thread overview]
Message-ID: <0304cb01-ed28-d16f-9384-1443db682b5c@windriver.com> (raw)
In-Reply-To: <20180202145952.285505-1-arnd@arndb.de>

On 02/02/2018 08:59 AM, Arnd Bergmann wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> ---
>   kernel/debug/kdb/kdb_support.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
> index 5d8ef3a07ecd..1ad4370ccbf0 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));
>   		}
> 


That is good by me.   Many thanks!  Added to queue.

Reviewed-by: Jason Wessel <jason.wessel@windriver.com>

Jason.

      reply	other threads:[~2018-02-02 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 14:59 Arnd Bergmann
2018-02-02 15:08 ` Jason Wessel [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=0304cb01-ed28-d16f-9384-1443db682b5c@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=ak@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=daniel.thompson@linaro.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@linaro.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

all inboxes | Powered by JetHome®