]> granicus.if.org Git - strace/commitdiff
tests: fix invalid pointer checks in getcpu test
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 30 Oct 2016 19:27:55 +0000 (22:27 +0300)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 30 Oct 2016 21:49:29 +0000 (00:49 +0300)
* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.

tests/getcpu.c

index baef1bb4928b88a2479fbbd5db275e892254b7aa..661840c5b2f191897253c0f8e5897381c6f3da26 100644 (file)
 int
 main(void)
 {
-       static const unsigned *bogus_cpu =
-               (unsigned *) (unsigned long) 0xfffffeedfffffaceULL;
-       static const unsigned *bogus_node =
-               (unsigned *) (unsigned long) 0xfffffca7ffffc0deULL;
-       static const unsigned *bogus_tcache =
-               (unsigned *) (unsigned long) 0xffffda7affffdeadULL;
+       unsigned *bogus_cpu =
+               (unsigned *) tail_alloc(sizeof(* bogus_cpu)) + 1;
+       unsigned *bogus_node =
+               (unsigned *) tail_alloc(sizeof(* bogus_node)) + 1;
+       unsigned *bogus_tcache =
+               (unsigned *) tail_alloc(sizeof(* bogus_tcache)) + 1;
 
        long res;
        unsigned *cpu = tail_alloc(sizeof(*cpu));