The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Kuniyuki Iwashima <kuniyu@amazon.co.jp>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>
Cc: Benjamin Herrenschmidt <benh@amazon.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/boot: Avoid redundant address overlap tests in memcpy().
Date: Mon, 24 Jan 2022 09:38:40 -0800	[thread overview]
Message-ID: <bd7c111c-8bd4-9c4d-4715-c0fb5fd034ee@intel.com> (raw)
In-Reply-To: <20220123015807.45005-1-kuniyu@amazon.co.jp>

On 1/22/22 17:58, Kuniyuki Iwashima wrote:
> -void *memmove(void *dest, const void *src, size_t n)
> +void *____memmove(void *dest, const void *src, size_t n)
>   {
>   	unsigned char *d = dest;
>   	const unsigned char *s = src;
>   
> -	if (d <= s || d - s >= n)
> -		return ____memcpy(dest, src, n);
> -
>   	while (n-- > 0)
>   		d[n] = s[n];
>   
>   	return dest;
>   }

The ___ naming is pretty cruel.  Could we call it memmove_no_overlap() 
or memmove_unsafe()?  Surely we can put some *useful* bytes in the name 
rather than padding it out with _'s.  No need to perpetuate the 
____memcpy() naming.

Also, is this worth the churn?  It probably saves less than 10 
instructions, all of which are ridiculously cheap.  Is there a *reason* 
for this other than being a pure cleanup?

  reply	other threads:[~2022-01-24 17:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  1:58 [PATCH] x86/boot: Avoid redundant address overlap tests in memcpy() Kuniyuki Iwashima
2022-01-24 17:38 ` Dave Hansen [this message]
2022-01-24 22:14   ` Kuniyuki Iwashima
2022-01-24 22:48     ` Borislav Petkov

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=bd7c111c-8bd4-9c4d-4715-c0fb5fd034ee@intel.com \
    --to=dave.hansen@intel.com \
    --cc=benh@amazon.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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