From: Eugene Syromyatnikov Date: Sun, 30 Oct 2016 19:28:37 +0000 (+0300) Subject: tests: fix invalid pointer checks in quotactl test X-Git-Tag: v4.15~159 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ca0852f5f91e64c2c135d2b698e7109dc2ccea5;p=strace tests: fix invalid pointer checks in quotactl test * 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. --- diff --git a/tests/quotactl-xfs.c b/tests/quotactl-xfs.c index da9175d2..81c02868 100644 --- a/tests/quotactl-xfs.c +++ b/tests/quotactl-xfs.c @@ -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")]; diff --git a/tests/quotactl.c b/tests/quotactl.c index d68c4ec8..6f48c97b 100644 --- a/tests/quotactl.c +++ b/tests/quotactl.c @@ -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")]; diff --git a/tests/quotactl.h b/tests/quotactl.h index edde915b..e73049f6 100644 --- a/tests/quotactl.h +++ b/tests/quotactl.h @@ -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/";