From patchwork Tue Jul 21 21:39:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 7786 Received: (qmail 78245 invoked by alias); 21 Jul 2015 21:39:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 78236 invoked by uid 89); 21 Jul 2015 21:39:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: shards.monkeyblade.net Date: Tue, 21 Jul 2015 14:39:04 -0700 (PDT) Message-Id: <20150721.143904.2006742147973414532.davem@davemloft.net> To: libc-alpha@sourceware.org Subject: [PATCH] Fix test-wcsncmp BUS errors. From: David Miller Mime-Version: 1.0 As currently coded, the strncmp tests dereference unaligned pointers when setting up the test patterns. This results in SIGBUS errors on Sparc, for example. Force the alignment arguments to be aligned properly for the character type being tested. Ok to commit? 2015-07-21 David S. Miller * string/test-strncmp.c (do_test_limit): Align align1 and align2 to CHARBYTES. (do_test): Likewise. diff --git a/string/test-strncmp.c b/string/test-strncmp.c index fb57a9b..277eb2c 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -156,6 +156,9 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char, size_t i, align_n; CHAR *s1, *s2; + align1 &= ~(CHARBYTES - 1); + align2 &= ~(CHARBYTES - 1); + if (n == 0) { s1 = (CHAR *) (buf1 + page_size); @@ -204,6 +207,9 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char, size_t i; CHAR *s1, *s2; + align1 &= ~(CHARBYTES - 1); + align2 &= ~(CHARBYTES - 1); + if (n == 0) return;