[LTP] [PATCH] ustat: Fix EFAULT in 32bit compatability mode

Richard Palethorpe rpalethorpe@suse.com
Thu Feb 7 11:18:35 CET 2019


This test fails with -m32 on Intel because the user land dev_num is too
large.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---

>From looking at glibc, this test may also be broken on mips, but I am not sure
if that matters. AFAICT on all other platforms glibc always casts to uint
after performing a sanity check..

 testcases/kernel/syscalls/ustat/ustat01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c
index 3f1186c49..2e7dcc9d7 100644
--- a/testcases/kernel/syscalls/ustat/ustat01.c
+++ b/testcases/kernel/syscalls/ustat/ustat01.c
@@ -20,7 +20,7 @@ void run(void)
 {
 	struct ustat ubuf;
 
-	TEST(tst_syscall(__NR_ustat, dev_num, &ubuf));
+	TEST(tst_syscall(__NR_ustat, (unsigned int)dev_num, &ubuf));
 
 	if (TST_RET == -1)
 		tst_res(TFAIL | TTERRNO, "ustat(2) failed");
-- 
2.20.1



More information about the ltp mailing list