mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@ezchip.com>
To: Chen Gang <gang.chen.5i5j@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	<jepler@unpythonic.net>
Subject: Re: [PATCH] arch: tile: kernel: kgdb.c: Use memcpy() instead of pointer copy one by one
Date: Wed, 12 Nov 2014 15:15:30 -0500	[thread overview]
Message-ID: <5463BFE2.4000404@ezchip.com> (raw)
In-Reply-To: <5462C1D3.3010504@gmail.com>

On 11/1/14 21:17, Chen Gang wrote:
> >Not only memcpy() is faster than pointer copy, but also let code more
> >clearer and simple, which can avoid compiling warning (the original
> >implementation copy registers by exceeding member array border).
> >
> >The related warning (with allmodconfig under tile):
> >
> >     CC      arch/tile/kernel/kgdb.o
> >   arch/tile/kernel/kgdb.c: In function 'sleeping_thread_to_gdb_regs':
> >   arch/tile/kernel/kgdb.c:140:31: warning: iteration 53u invokes undefined behavior [-Waggressive-loop-optimizations]
> >      *(ptr++) = thread_regs->regs[reg];
> >                                  ^
> >   arch/tile/kernel/kgdb.c:139:2: note: containing loop
> >     for (reg = 0; reg <= TREG_LAST_GPR; reg++)
> >     ^
> >
> >Signed-off-by: Chen Gang<gang.chen.5i5j@gmail.com>
> >---
> >  arch/tile/kernel/kgdb.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >

Taken into the tile tree - thanks!

See my recent email about changing the shape of the pt_regs and sigcontext
structures to make the regs[] usage explicit.  But even with that, I
think your change makes sense to simplify the code in this location.

-- 
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com


  parent reply	other threads:[~2014-11-12 20:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-01 13:17 Chen Gang
2014-11-12  2:11 ` Chen Gang
2014-11-12 13:27   ` Jeff Epler
2014-11-12 15:43     ` Chen Gang
2014-11-12 19:29       ` Jeff Epler
2014-11-12 20:15   ` Chris Metcalf [this message]
2014-11-13  0:08 Chen Gang

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=5463BFE2.4000404@ezchip.com \
    --to=cmetcalf@ezchip.com \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=jepler@unpythonic.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

Powered by JetHome