[PATCH] tst-fmon/tst-numeric: switch malloc to static stack space [BZ #19671]

Mike Frysinger vapier@gentoo.org
Sat Apr 23 18:25:00 GMT 2016


On 23 Apr 2016 14:23, Florian Weimer wrote:
> * Mike Frysinger:
> > The current test code doesn't check the return value of malloc.
> > This should rarely (if ever) cause a problem, but rather than add
> > some return value checks, just statically allocate the buffer on
> > the stack.  This will never fail (or if it does, we've got much
> > bigger problems that don't matter to the test).
> 
> This needs a ChangeLog entry.

i don't bother writing ChangeLog entries until before i push.
it helps minimize time wastage.

> > -  char *s = malloc (201);
> > +  char s[201];
> 
> Please use a enum constant of 200, and also pass it to strfmon.
> K think the current 200/201 choice is technically incorrect
> (the maximum includes the terminating null byte).

these two tests are both badly written.  i've changed it to sizeof.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tst-fmon-tst-numeric-switch-malloc-to-static-stack-s.patch
Type: text/x-diff
Size: 1862 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160423/36218519/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160423/36218519/attachment.sig>


More information about the Libc-alpha mailing list