aboutsummaryrefslogtreecommitdiff
path: root/testcases/kernel
diff options
context:
space:
mode:
authorCyril Hrubis <chrubis@suse.cz>2019-04-04 12:16:27 +0200
committerCyril Hrubis <chrubis@suse.cz>2019-04-04 12:16:27 +0200
commit1f9b90507552646334d7590d13137b2c0ed40c9d (patch)
tree90847a7ac2f66ed28fca2eb10514132c264038d8 /testcases/kernel
parentdb2f0ed9ec942059b9bea5a78cc2c4f49214ec5a (diff)
syscalls/fstat05: Fix failures
Quoting Wei Li: " On my machine running linux-4.19.23, the fstat05 test case went failed: [root@localhost ltp_20180926_src]# ./testcases/kernel/syscalls/fstat/fstat05 fstat05 1 TFAIL : fstat05.c:168: fstat() returned 0 but we wanted -1 Finally i found that, the end of head was expanded after invoking setup(), more than 4 * getpagesize(), then ptr_str is not a point outside user's accessible address space any more. " This fixes the test by using the tst_get_bad_addr() instead of sbrk() + delta. Reported-by: Wei Li <liwei391@huawei.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'testcases/kernel')
-rw-r--r--testcases/kernel/syscalls/fstat/fstat05.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/testcases/kernel/syscalls/fstat/fstat05.c b/testcases/kernel/syscalls/fstat/fstat05.c
index 8de5d070a..200de4130 100644
--- a/testcases/kernel/syscalls/fstat/fstat05.c
+++ b/testcases/kernel/syscalls/fstat/fstat05.c
@@ -129,16 +129,11 @@ int SIG_SEEN = sizeof(siglist) / sizeof(int);
int main(int ac, char **av)
{
- struct stat stat_buf; /* stat structure buffer */
- struct stat *ptr_str;
+ struct stat *ptr_str = tst_get_bad_addr(NULL);
int lc;
tst_parse_opts(ac, av, NULL, NULL);
- /* Buffer points outside user's accessible address space. */
- ptr_str = &stat_buf; /* if it was for conformance testing */
- ptr_str = (void *)sbrk(0) + (4 * getpagesize());
-
/*
* Invoke setup function
*/