public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Senkevich <andrew.n.senkevich@gmail.com>
To: Andreas Schwab <schwab@suse.de>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
	Florian Weimer <fweimer@redhat.com>,
	 Szabolcs Nagy <szabolcs.nagy@arm.com>, nd <nd@arm.com>,
	 libc-alpha <libc-alpha@sourceware.org>, Max Horn <max@quendi.de>,
	thomas@grindinggear.com
Subject: Re: [PATCH] Fix i386 memmove issue [BZ #22644]
Date: Fri, 23 Mar 2018 17:15:00 -0000	[thread overview]
Message-ID: <CAMXFM3sJHYrVNEe6A=3fMz7CLi+qOf1XZFV8-h-dTvGbv9fOSA@mail.gmail.com> (raw)
In-Reply-To: <mvmo9jji0n3.fsf@suse.de>

2018-03-20 9:58 GMT+01:00 Andreas Schwab <schwab@suse.de>:
> On Mär 19 2018, Andrew Senkevich <andrew.n.senkevich@gmail.com> wrote:
>
>> diff --git a/string/test-memmove.c b/string/test-memmove.c
>> index edc7a4c..9f1437d 100644
>> --- a/string/test-memmove.c
>> +++ b/string/test-memmove.c
>> @@ -24,6 +24,7 @@
>>  # define TEST_NAME "memmove"
>>  #endif
>>  #include "test-string.h"
>> +#include <support/test-driver.h>
>>
>>  char *simple_memmove (char *, const char *, size_t);
>>
>> @@ -245,6 +246,60 @@ do_random_tests (void)
>>      }
>>  }
>>
>> +static void
>> +do_test2 (void)
>> +{
>> +  size_t size = 0x20000000;
>> +  uint32_t * large_buf;
>> +
>> +  large_buf = mmap ((void*)0x70000000, size, PROT_READ | PROT_WRITE,
>> +     MAP_PRIVATE | MAP_ANON, -1, 0);
>
> Style: line up indentation with paren.
>
>> +
>> +  if (large_buf == MAP_FAILED)
>> +    error (EXIT_UNSUPPORTED, errno, "Large mmap failed");
>> +
>> +  if ((uintptr_t)large_buf > 0x80000000 - 128
>> +      || 0x80000000 - (uintptr_t)large_buf > 0x20000000)
>
> Style: space after cast.
>
>> +    {
>> +      error (0, 0,"Large mmap allocated improperly");
>
> Style: space after comma.
>
>> +      ret = EXIT_UNSUPPORTED;
>> +      munmap((void *)large_buf, size);
>
> Style: space before paren and after cast.
>
>> +      return;
>> +    }
>> +
>> +  size_t bytes_move = 0x80000000 - (uintptr_t)large_buf;
>
> Style: space after cast.
>
>> +  size_t arr_size = bytes_move / sizeof(uint32_t);
>
> Style: space before paren.
>
>> +  size_t i;
>> +
>> +  FOR_EACH_IMPL (impl, 0)
>> +    {
>> +      for (i = 0; i < arr_size; i++)
>> +        large_buf[i] = i;
>> +
>> +      uint32_t * dst = &large_buf[33];
>> +
>> +#ifdef TEST_BCOPY
>> +      CALL (impl, (char *)large_buf, (char *)dst, bytes_move);
>> +#else
>> +      CALL (impl, (char *)dst, (char *)large_buf, bytes_move);
>> +#endif
>
> Styles: space after cast.
>
>> +
>> +      for (i = 0; i < arr_size; i++)
>> +        {
>> +          if (dst[i] != i)
>> +     {
>
> Style: wrong indentation.
>
>> +       error (0, 0,
>> +      "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%d\"",
>> +      impl->name, dst, large_buf, i);
>
> Style: line up indentation with paren.
>
>> +       ret = 1;
>> +       break;
>> +     }
>> + }
>> +    }
>> +
>> +  munmap((void *)large_buf, size);
>
> Style: space before paren and after cast.

Thanks, committed with fixed style.

I will also backport it to affected branches.


--
WBR,
Andrew

      reply	other threads:[~2018-03-23 17:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 10:13 Andrew Senkevich
2018-02-19 10:31 ` Andreas Schwab
2018-03-14 14:43   ` Andrew Senkevich
2018-03-14 14:59     ` H.J. Lu
2018-03-19 12:46       ` Andrew Senkevich
2018-03-19 12:55         ` H.J. Lu
2018-03-19 13:11         ` Andreas Schwab
2018-03-19 13:17           ` Florian Weimer
2018-03-19 14:01             ` Andrew Senkevich
2018-03-19 14:25             ` Szabolcs Nagy
2018-03-19 15:33               ` Florian Weimer
2018-03-19 17:52                 ` Andrew Senkevich
2018-03-19 17:57                   ` H.J. Lu
2018-03-19 19:30                     ` Andrew Senkevich
2018-03-19 19:38                       ` H.J. Lu
2018-03-19 20:33                         ` Andrew Senkevich
2018-03-19 20:50                           ` H.J. Lu
2018-03-20  8:58                           ` Andreas Schwab
2018-03-23 17:15                             ` Andrew Senkevich [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='CAMXFM3sJHYrVNEe6A=3fMz7CLi+qOf1XZFV8-h-dTvGbv9fOSA@mail.gmail.com' \
    --to=andrew.n.senkevich@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=max@quendi.de \
    --cc=nd@arm.com \
    --cc=schwab@suse.de \
    --cc=szabolcs.nagy@arm.com \
    --cc=thomas@grindinggear.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).