From 5d6f7a0e1e094547aaa4fd62d8e7874c9a1cc9b4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 16 Sep 2024 12:51:16 +0200 Subject: [PATCH] getdents: account for d_name size in tst_dirp_size The linux_dirent and linux_dirent64 structs do not contain space for the d_name member. Add NAME_MAX to the size in tst_dirp_size so that the getdents syscalls do not spuriously fail with EINVAL instead of EFAULT. Signed-off-by: Andreas Schwab Acked-by: Jan Stancek Reviewed-by: Cyril Hrubis --- testcases/kernel/syscalls/getdents/getdents.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h index 560df41267d..02c3bc509a7 100644 --- a/testcases/kernel/syscalls/getdents/getdents.h +++ b/testcases/kernel/syscalls/getdents/getdents.h @@ -64,9 +64,9 @@ tst_dirp_size(void) { switch (tst_variant) { case 0: - return sizeof(struct linux_dirent); + return sizeof(struct linux_dirent) + NAME_MAX; case 1: - return sizeof(struct linux_dirent64); + return sizeof(struct linux_dirent64) + NAME_MAX; #if HAVE_GETDENTS case 2: return sizeof(struct dirent);