* Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
@ 2018-02-01 20:37 Joseph Myers
2018-02-06 18:03 ` Ping " Joseph Myers
2018-02-06 18:45 ` Florian Weimer
0 siblings, 2 replies; 4+ messages in thread
From: Joseph Myers @ 2018-02-01 20:37 UTC (permalink / raw)
To: libc-alpha
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 <joseph@codesourcery.com>
[BZ #19668]
* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
<support/support.h>. Do not include <malloc.h>.
(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 <string.h>
#include <ucontext.h>
#include <unistd.h>
-#include <malloc.h>
#include <link.h>
#include <elf.h>
#include <fpu_control.h>
#include <sys/auxv.h>
+#include <support/support.h>
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
{
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Ping Re: Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
2018-02-01 20:37 Use xmalloc in tst-setcontext-fpscr.c (bug 19668) Joseph Myers
@ 2018-02-06 18:03 ` Joseph Myers
2018-02-06 18:45 ` Florian Weimer
1 sibling, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2018-02-06 18:03 UTC (permalink / raw)
To: libc-alpha
Ping. This patch
<https://sourceware.org/ml/libc-alpha/2018-02/msg00036.html> is pending
review.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
2018-02-01 20:37 Use xmalloc in tst-setcontext-fpscr.c (bug 19668) Joseph Myers
2018-02-06 18:03 ` Ping " Joseph Myers
@ 2018-02-06 18:45 ` Florian Weimer
2018-02-06 21:47 ` Joseph Myers
1 sibling, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2018-02-06 18:45 UTC (permalink / raw)
To: Joseph Myers, libc-alpha
On 02/01/2018 09:37 PM, Joseph Myers wrote:
> - auxv = (ElfW(auxv_t) *)malloc(getpagesize());
> + auxv = (ElfW(auxv_t) *) xmalloc (getpagesize ());
This is okay, but you might as well drop the cast.
Thanks,
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use xmalloc in tst-setcontext-fpscr.c (bug 19668)
2018-02-06 18:45 ` Florian Weimer
@ 2018-02-06 21:47 ` Joseph Myers
0 siblings, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2018-02-06 21:47 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
On Tue, 6 Feb 2018, Florian Weimer wrote:
> On 02/01/2018 09:37 PM, Joseph Myers wrote:
> > - auxv = (ElfW(auxv_t) *)malloc(getpagesize());
> > + auxv = (ElfW(auxv_t) *) xmalloc (getpagesize ());
>
> This is okay, but you might as well drop the cast.
Done.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-06 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 20:37 Use xmalloc in tst-setcontext-fpscr.c (bug 19668) Joseph Myers
2018-02-06 18:03 ` Ping " Joseph Myers
2018-02-06 18:45 ` Florian Weimer
2018-02-06 21:47 ` Joseph Myers
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).