xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Paul Semel <phentex@amazon.com>, xen-devel@lists.xenproject.org
Cc: wipawel@amazon.de, Paul Semel <phentex@amazon.de>
Subject: Re: [PATCH xtf] libc: Fix strcpy() assignment mistake
Date: Wed, 11 Oct 2017 14:22:45 +0100	[thread overview]
Message-ID: <170bdfe5-7890-46b7-a5b2-b6232e55db7f@citrix.com> (raw)
In-Reply-To: <1507727249-93295-1-git-send-email-phentex@amazon.com>

On 11/10/17 14:07, Paul Semel wrote:
> From: Paul Semel <phentex@amazon.de>
>
> the strcpy function was doing a comparison instead of doing an
> assignment.
>
> Signed-off-by: Paul Semel <phentex@amazon.de>
>
> Reviewed-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reviewed-by: Bjoern Doebel <doebel@amazon.de>
> Reviewed-by: Martin Pohlack <mpohlack@amazon.de>

Oops.  This issue is hidden due to __builtin_strcpy() optimising all
in-tree callsites.

Reviewed-and-tested-by: Andrew Cooper <andrew.cooper3@citrix.com>, and
pushed.

> ---
>  common/libc/string.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/libc/string.c b/common/libc/string.c
> index 94acc7e..967f2fa 100644
> --- a/common/libc/string.c
> +++ b/common/libc/string.c
> @@ -24,7 +24,7 @@ size_t strnlen(const char *str, size_t max)

It looks like git isn't terribly happy with the (strcpy) preprocessor
trick.  I did a double-take when I first read the patch.

~Andrew

>  {
>      char *p = dst;
>  
> -    while ( *p++ == *src++ )
> +    while ( (*p++ = *src++) )
>          ;
>  
>      return dst;


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2017-10-11 13:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11 13:07 [PATCH xtf] libc: Fix strcpy() assignment mistake Paul Semel
2017-10-11 13:22 ` Andrew Cooper [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=170bdfe5-7890-46b7-a5b2-b6232e55db7f@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=phentex@amazon.com \
    --cc=phentex@amazon.de \
    --cc=wipawel@amazon.de \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).