This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix i386 memmove issue [BZ #22644]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]