The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
To: <dave.hansen@intel.com>
Cc: <benh@amazon.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,
	<kuni1840@gmail.com>, <kuniyu@amazon.co.jp>,
	<linux-kernel@vger.kernel.org>, <mingo@redhat.com>,
	<tglx@linutronix.de>, <x86@kernel.org>
Subject: Re: [PATCH] x86/boot: Avoid redundant address overlap tests in memcpy().
Date: Tue, 25 Jan 2022 07:14:47 +0900	[thread overview]
Message-ID: <20220124221447.1030-1-kuniyu@amazon.co.jp> (raw)
In-Reply-To: <bd7c111c-8bd4-9c4d-4715-c0fb5fd034ee@intel.com>

From:   Dave Hansen <dave.hansen@intel.com>
Date:   Mon, 24 Jan 2022 09:38:40 -0800
> 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.

Sure.  I will rename it to memmove_unsafe() because it supports another
overlap case. (d > s)


> 
> 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?

This is just for cleanup.

  reply	other threads:[~2022-01-24 23:23 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
2022-01-24 22:14   ` Kuniyuki Iwashima [this message]
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=20220124221447.1030-1-kuniyu@amazon.co.jp \
    --to=kuniyu@amazon.co.jp \
    --cc=benh@amazon.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kuni1840@gmail.com \
    --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