]> granicus.if.org Git - strace/commitdiff
tests: fix invalid pointer checks in quotactl test
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 30 Oct 2016 19:28:37 +0000 (22:28 +0300)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 30 Oct 2016 21:49:29 +0000 (00:49 +0300)
* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.

tests/quotactl-xfs.c
tests/quotactl.c
tests/quotactl.h

index da9175d211e04ec68adc855f76a12fed97bb919d..81c02868495cab5e8fcc7ab11614196a0485e1af 100644 (file)
@@ -199,6 +199,9 @@ print_xquota_statv(int rc, void *ptr, void *arg)
 int
 main(void)
 {
+       char *bogus_special = (char *) tail_alloc(1) + 1;
+       void *bogus_addr = (char *) tail_alloc(1) + 1;
+
        char bogus_special_str[sizeof(void *) * 2 + sizeof("0x")];
        char bogus_addr_str[sizeof(void *) * 2 + sizeof("0x")];
        char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];
index d68c4ec8f81cb0c5e1b98a32fdc7df810a6db302..6f48c97bbf9efdd4e888e36b718eefa397fe0e0f 100644 (file)
@@ -164,6 +164,9 @@ print_dqinfo(long rc, void *ptr, void *arg)
 int
 main(void)
 {
+       char *bogus_special = (char *) tail_alloc(1) + 1;
+       void *bogus_addr = (char *) tail_alloc(1) + 1;
+
        char bogus_special_str[sizeof(void *) * 2 + sizeof("0x")];
        char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];
 
index edde915b157e242b3b290038dfedec70c8a2085e..e73049f6e99b3174805806e988f6eb02acd6019f 100644 (file)
@@ -155,11 +155,7 @@ check_quota(uint32_t flags, int cmd, const char *cmd_str,
 
 
 static const int bogus_cmd = 0xbadc0ded;
-static const char * const bogus_special =
-       (const char *) (unsigned long) 0xfffffca7ffffc0deULL;
 static const int bogus_id = 0xca7faced;
-static void * const bogus_addr =
-       (void *) (unsigned long) 0xffffda7affffdeadULL;
 
 /* It is invalid anyway due to the flash in the end */
 static const char *bogus_dev = "/dev/bogus/";