From patchwork Thu Feb 1 20:37:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 25741 Received: (qmail 119932 invoked by alias); 1 Feb 2018 20:37:33 -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 119919 invoked by uid 89); 1 Feb 2018 20:37:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Thu, 1 Feb 2018 20:37:24 +0000 From: Joseph Myers To: Subject: Use xmalloc in tst-setcontext-fpscr.c (bug 19668) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) Bug 19668 reports an unchecked malloc call in the test sysdeps/powerpc/fpu/tst-setcontext-fpscr.c. This patch makes that test use xmalloc. It does not otherwise move this test to the support/ infrastructure or support/test-driver.c; the test has various uses of exit and _exit on error cases, and uses atexit, and while I think those things would all still work in the context of test-driver.c, it's not an immediately obvious conversion the way it would be for many tests that don't use test-driver.c. Tested for powerpc. 2018-02-01 Joseph Myers [BZ #19668] * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include . Do not include . (query_auxv): Use xmalloc instead of malloc. diff --git a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c index c64ca88..f39f1c4 100644 --- a/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c +++ b/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c @@ -23,11 +23,11 @@ #include #include #include -#include #include #include #include #include +#include static ucontext_t ctx[3]; @@ -59,7 +59,7 @@ ElfW(Addr) query_auxv(int type) perror("Error opening file for reading"); return 0; } - auxv = (ElfW(auxv_t) *)malloc(getpagesize()); + auxv = (ElfW(auxv_t) *) xmalloc (getpagesize ()); do {