* [PATCH xtf] libc: Fix strcpy() assignment mistake
@ 2017-10-11 13:07 Paul Semel
2017-10-11 13:22 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Paul Semel @ 2017-10-11 13:07 UTC (permalink / raw)
To: xen-devel; +Cc: andrew.cooper3, Paul Semel, wipawel
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>
---
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)
{
char *p = dst;
- while ( *p++ == *src++ )
+ while ( (*p++ = *src++) )
;
return dst;
--
1.8.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH xtf] libc: Fix strcpy() assignment mistake
2017-10-11 13:07 [PATCH xtf] libc: Fix strcpy() assignment mistake Paul Semel
@ 2017-10-11 13:22 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2017-10-11 13:22 UTC (permalink / raw)
To: Paul Semel, xen-devel; +Cc: wipawel, Paul Semel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-11 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-11 13:07 [PATCH xtf] libc: Fix strcpy() assignment mistake Paul Semel
2017-10-11 13:22 ` Andrew Cooper
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).