Skip to contentSkip to conversation

io_pgetevents02: Pass the union member of tst_ts

PATCH In review Richard Palethorpe via ltp 3 participants 3 messages Sep 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_pgetevents02: Pass the union member of tst_ts

Currently we pass the whole tst_ts struct. The kernel expects the union part of this struct.

---

Note that because bad_addr is (void *) the whole ternary expression becomes (void *). The tc->timeout is then also implicitly cast to void.

 testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c +2 -5
index af71e17fe..d763e150f 100644
@@ -93,11 +93,8 @@ static void run(unsigned int n)
 {
 	struct time64_variants *tv = &variants[tst_variant];
 	struct tcase *tc = &tcases[n];
-	struct timespec *to;
-	sigset_t *sigmask;
-
-	sigmask = tc->sigmask ? tc->sigmask : bad_addr;
-	to = tc->timeout ? tc->timeout : bad_addr;
+	void *const to = tc->timeout ? tst_ts_get(tc->timeout) : bad_addr;
+	sigset_t *const sigmask = tc->sigmask ? tc->sigmask : bad_addr;
 
 	TEST(tv->io_pgetevents(*tc->ctx, tc->min_nr, tc->max_nr, tc->events, to,
 			       sigmask));
Signature · 5 lines
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Richard,

Quoted 2 lines

Currently we pass the whole tst_ts struct. The kernel expects the union part of this struct.

Thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp