public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: Ma Xinjian <maxj.fnst@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] getdents02: Add case for errno EFAULT
Date: Tue, 20 Aug 2024 09:31:52 +0200	[thread overview]
Message-ID: <26537985.1r3eYUQgxm@localhost> (raw)
In-Reply-To: <20240819082213.2150403-1-maxj.fnst@fujitsu.com>

Hi,

Reviewed-by: Avinesh Kumar <akumar@suse.de>


On Monday, August 19, 2024 10:22:13 AM GMT+2 Ma Xinjian via ltp wrote:
> Currently there is no case for EFAULT, so a new case is added.
> 
> Signed-off-by: Ma Xinjian <maxj.fnst@fujitsu.com>
> ---
>  testcases/kernel/syscalls/getdents/getdents02.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/getdents/getdents02.c b/testcases/kernel/syscalls/getdents/getdents02.c
> index ade1c9476..578db9d1e 100644
> --- a/testcases/kernel/syscalls/getdents/getdents02.c
> +++ b/testcases/kernel/syscalls/getdents/getdents02.c
> @@ -15,6 +15,7 @@
>   *   - getdents() fails with EINVAL if result buffer is too small
>   *   - getdents() fails with ENOTDIR if file descriptor does not refer to a directory
>   *   - getdents() fails with ENOENT if directory was unlinked()
> + *   - getdents() fails with EFAULT if argument points outside the calling process's address space
>   */
>  
>  #define _GNU_SOURCE
> @@ -34,6 +35,7 @@ static size_t size;
>  
>  static char dirp1_arr[1];
>  static char *dirp1 = dirp1_arr;
> +static char *dirp_bad;
>  static size_t size1 = 1;
>  
>  static int fd_inv = -5;
> @@ -51,6 +53,7 @@ static struct tcase {
>  	{ &fd, &dirp1, &size1, EINVAL },
>  	{ &fd_file, &dirp, &size, ENOTDIR },
>  	{ &fd_unlinked, &dirp, &size, ENOENT },
> +	{ &fd, &dirp_bad, &size, EFAULT },
>  };
>  
>  static void setup(void)
> @@ -63,6 +66,8 @@ static void setup(void)
>  	fd = SAFE_OPEN(".", O_RDONLY);
>  	fd_file = SAFE_OPEN("test", O_CREAT | O_RDWR, 0644);
>  
> +	dirp_bad = tst_get_bad_addr(NULL);
> +
>  	SAFE_MKDIR(TEST_DIR, DIR_MODE);
>  	fd_unlinked = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
>  	SAFE_RMDIR(TEST_DIR);
> 

Regards,
Avinesh




-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-08-20  7:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19  8:22 [LTP] [PATCH] getdents02: Add case for errno EFAULT Ma Xinjian via ltp
2024-08-20  7:31 ` Avinesh Kumar [this message]
2024-08-20 11:59   ` Li Wang
2024-08-26 18:12 ` Avinesh Kumar

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=26537985.1r3eYUQgxm@localhost \
    --to=akumar@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=maxj.fnst@fujitsu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox