From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67751 invoked by alias); 20 Mar 2018 08:58:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 67349 invoked by uid 89); 20 Mar 2018 08:58:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de From: Andreas Schwab To: Andrew Senkevich Cc: "H.J. Lu" , Florian Weimer , Szabolcs Nagy , nd , libc-alpha , Max Horn , thomas@grindinggear.com Subject: Re: [PATCH] Fix i386 memmove issue [BZ #22644] References: <597954a1-85da-e524-1454-27c46af57413@redhat.com> <8c8ab285-bddc-90e6-a50e-7be89703367a@redhat.com> X-Yow: I'm pretending I'm pulling in a TROUT! Am I doing it correctly?? Date: Tue, 20 Mar 2018 08:58:00 -0000 In-Reply-To: (Andrew Senkevich's message of "Mon, 19 Mar 2018 21:32:27 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-03/txt/msg00486.txt.bz2 On Mär 19 2018, Andrew Senkevich 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 > > 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. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."