Author: abartlet
Date: 2006-09-14 05:13:20 +0000 (Thu, 14 Sep 2006)
New Revision: 18498

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18498

Log:
While passing stack values into torture_tcase_add_test is bad, values
assigned into a static initialiser must be constant.

Wishing sweet dreams on the jet-lagged tridge :-)

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/torture/local/irpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/irpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/irpc.c      2006-09-14 03:23:52 UTC 
(rev 18497)
+++ branches/SAMBA_4_0/source/torture/local/irpc.c      2006-09-14 05:13:20 UTC 
(rev 18498)
@@ -242,12 +242,17 @@
        struct torture_suite *suite = torture_suite_create(mem_ctx, 
"LOCAL-IRPC");
        struct torture_tcase *tcase = torture_suite_add_tcase(suite, "irpc");
        int i;
-       static uint32_t values[] = {0, 0x7FFFFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 
-                                   random() & 0xFFFFFFFF};
+       uint32_t *values = talloc_array(tcase, uint32_t, 5);
 
+       values[0] = 0;
+       values[1] = 0x7FFFFFFE;
+       values[2] = 0xFFFFFFFE;
+       values[3] = 0xFFFFFFFF;
+       values[4] = random() & 0xFFFFFFFF;
+
        tcase->setup = irpc_setup;
 
-       for (i = 0; i < ARRAY_SIZE(values); i++) {
+       for (i = 0; i < 5; i++) {
                torture_tcase_add_test(tcase, "addone", test_addone, (void 
*)values[i]);
        }
                                                   

Reply via email to