diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-12-01 00:08:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-12-01 00:08:00 +0000 |
commit | 20a6e50cb077f44e240e95ebcd492a1ad31d4be6 (patch) | |
tree | 766d3b80ebe5e9c2181fb611dcf033d3d5a50078 | |
parent | 2bf6aafbd4310390d8d745b24c6992c68a16b1e4 (diff) | |
download | strace-20a6e50cb077f44e240e95ebcd492a1ad31d4be6.tar.gz |
tests: robustify ioctl_hdio tests
* tests/ioctl_hdio.c (main): Do not assume 0xdeadbeef is an inaccessible
pointer because sometimes this address is accessible, create an
inaccessible pointer and use it instead of 0xdeadbeef.
-rw-r--r-- | tests/ioctl_hdio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/ioctl_hdio.c b/tests/ioctl_hdio.c index 7f2880570..a4d02282b 100644 --- a/tests/ioctl_hdio.c +++ b/tests/ioctl_hdio.c @@ -229,14 +229,16 @@ main(int argc, char *argv[]) /* HDIO compat has never been supported by the kernel. */ #ifndef MPERS_IS_m32 + void *const efault = tail_alloc(1) + 1; + /* HDIO_DRIVE_RESET */ printf("ioctl(-1, %s, NULL) = %s\n", XLAT_STR(HDIO_DRIVE_RESET), errstr); do_ioctl_ptr(HDIO_DRIVE_RESET, 0); printf("ioctl(-1, %s, %p) = %s\n", - XLAT_STR(HDIO_DRIVE_RESET), (void *) 0xdeadbeef, errstr); - do_ioctl(HDIO_DRIVE_RESET, 0xdeadbeef); + XLAT_STR(HDIO_DRIVE_RESET), efault, errstr); + do_ioctl(HDIO_DRIVE_RESET, (uintptr_t) efault); printf("ioctl(-1, %s, [%#x, %#x, %#x]) = %s\n", XLAT_STR(HDIO_DRIVE_RESET), @@ -252,8 +254,8 @@ main(int argc, char *argv[]) do_ioctl_ptr(HDIO_SCAN_HWIF, 0); printf("ioctl(-1, %s, %p) = %s\n", - XLAT_STR(HDIO_SCAN_HWIF), (void *) 0xdeadbeef, errstr); - do_ioctl(HDIO_SCAN_HWIF, 0xdeadbeef); + XLAT_STR(HDIO_SCAN_HWIF), efault, errstr); + do_ioctl(HDIO_SCAN_HWIF, (uintptr_t) efault); printf("ioctl(-1, %s, [%#x, %#x, %#x]) = %s\n", XLAT_STR(HDIO_SCAN_HWIF), |