Skip to content

Commit

Permalink
getdents: account for d_name size in tst_dirp_size
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jan Stancek <[email protected]>
Reviewed-by: Cyril Hrubis <[email protected]>
  • Loading branch information
andreas-schwab authored and metan-ucw committed Sep 16, 2024
1 parent 5528da0 commit 5d6f7a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testcases/kernel/syscalls/getdents/getdents.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5d6f7a0

Please sign in to comment.