[LTP] [PATCH] syscalls/sched_getattr02: use a fixed size for EINVAL test

Jan Stancek jstancek@redhat.com
Fri Nov 1 14:02:01 CET 2024


Test is using a 'size' based on sizeof(struct sched_attr), but
since c48700d8cdbe ("sched_attr: Do not define for glibc >= 2.41")
that structure can now be defined by glibc which also defines additional
fields.

The kernel only checks if size is smaller than SCHED_ATTR_SIZE_VER0 (48 bytes).
Man page mentions this size directly, so just use a fixed size for the test.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/sched_getattr/sched_getattr02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
index 5efec2ff5a95..d2099d09f532 100644
--- a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
+++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
@@ -51,7 +51,7 @@ static struct test_case {
 } test_cases[] = {
 	{&unused_pid, &attr_copy, sizeof(struct sched_attr), 0, ESRCH},
 	{&pid, NULL, sizeof(struct sched_attr), 0, EINVAL},
-	{&pid, &attr_copy, sizeof(struct sched_attr) - 1, 0, EINVAL},
+	{&pid, &attr_copy, 47, 0, EINVAL},
 	{&pid, &attr_copy, sizeof(struct sched_attr), 1000, EINVAL}
 };
 
-- 
2.43.0



More information about the ltp mailing list