diff options
author | Xiao Yang <yangx.jy@cn.fujitsu.com> | 2018-02-13 16:41:36 +0800 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2018-02-13 12:11:42 +0100 |
commit | 79b720d24f6349e1f7a22443dc2ac5d63f74351c (patch) | |
tree | 63948da5dcc806df864f7b68b4e79337ebfce3d9 | |
parent | b745b0053c05f96df2acd15af7f434e468f9174d (diff) |
syscalls/mremap03: Do not pass MAP_FAILED into mremap()
Running mremap03 -i n got the following errors:
-----------------------------------------------
mremap03 1 TPASS : mremap() Fails, 'old region not mapped', errno 14
mremap03 1 TFAIL : mremap03.c:137: mremap() Fails, 'Unexpected errno 22
...
-----------------------------------------------
When running mremap03 in loops, we passed MAP_FAILED instead of bad
address into mremap().
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
-rw-r--r-- | testcases/kernel/syscalls/mremap/mremap03.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/testcases/kernel/syscalls/mremap/mremap03.c b/testcases/kernel/syscalls/mremap/mremap03.c index 12e3829bf..5cd1a6794 100644 --- a/testcases/kernel/syscalls/mremap/mremap03.c +++ b/testcases/kernel/syscalls/mremap/mremap03.c @@ -84,7 +84,8 @@ char *TCID = "mremap03"; int TST_TOTAL = 1; -char *addr; /* addr of memory mapped region */ +static char *bad_addr; +static char *addr; /* addr of memory mapped region */ int memsize; /* memory mapped size */ int newsize; /* new size of virtual memory block */ @@ -111,7 +112,7 @@ int main(int ac, char **av) * virtual address was not mapped. */ errno = 0; - addr = mremap(addr, memsize, newsize, MREMAP_MAYMOVE); + addr = mremap(bad_addr, memsize, newsize, MREMAP_MAYMOVE); TEST_ERRNO = errno; /* Check for the return value of mremap() */ @@ -173,7 +174,7 @@ void setup(void) * Set the old virtual address point to some address * which is not mapped. */ - addr = (char *)get_high_address(); + bad_addr = (char *)get_high_address(); } /* |