From: Andreas Schwab <schwab@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] getdents: account for d_name size in tst_dirp_size
Date: Mon, 16 Sep 2024 12:51:16 +0200 [thread overview]
Message-ID: <mvmplp327ob.fsf@suse.de> (raw)
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 <schwab@suse.de>
---
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 560df4126..02c3bc509 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);
--
2.46.1
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2024-09-16 10:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 10:51 Andreas Schwab [this message]
2024-09-16 11:15 ` [LTP] [PATCH] getdents: account for d_name size in tst_dirp_size Jan Stancek
2024-09-16 12:09 ` Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2024-09-16 9:29 Andreas Schwab
2024-09-16 10:32 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvmplp327ob.fsf@suse.de \
--to=schwab@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.