Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Abhinav Jain <jain.abhinav177@gmail.com>,
	shuah@kernel.org, brauner@kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: javier.carrasco.cruz@gmail.com, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests: filesystems: fix warn_unused_result build warnings
Date: Fri, 16 Aug 2024 07:11:54 -0600	[thread overview]
Message-ID: <5fd97d54-fa64-4c03-865f-961ed4596a6e@linuxfoundation.org> (raw)
In-Reply-To: <20240810135333.672845-1-jain.abhinav177@gmail.com>

On 8/10/24 07:53, Abhinav Jain wrote:
> Add return value checks for read & write calls in test_listmount_ns
> function. This patch resolves below compilation warnings:
> 
> ```
> statmount_test_ns.c: In function ‘test_listmount_ns’:
> 
> statmount_test_ns.c:322:17: warning: ignoring return value of ‘write’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
> 
> statmount_test_ns.c:323:17: warning: ignoring return value of ‘read’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
> ```
> 
> Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
> ---
>   .../selftests/filesystems/statmount/statmount_test_ns.c    | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c b/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
> index e044f5fc57fd..70cb0c8b21cf 100644
> --- a/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
> +++ b/tools/testing/selftests/filesystems/statmount/statmount_test_ns.c
> @@ -319,8 +319,11 @@ static void test_listmount_ns(void)
>   		 * Tell our parent how many mounts we have, and then wait for it
>   		 * to tell us we're done.
>   		 */
> -		write(child_ready_pipe[1], &nr_mounts, sizeof(nr_mounts));
> -		read(parent_ready_pipe[0], &cval, sizeof(cval));
> +		if (write(child_ready_pipe[1], &nr_mounts, sizeof(nr_mounts)) !=
> +					sizeof(nr_mounts))
> +			ret = NSID_ERROR;
> +		if (read(parent_ready_pipe[0], &cval, sizeof(cval)) != sizeof(cval))
> +			ret = NSID_ERROR;
>   		exit(NSID_PASS);
>   	}
>   

Hi Christian,

Let me know if it is okay to take this patch through kselftest tree.
The change looks good to me.

thanks,
-- Shuah

  reply	other threads:[~2024-08-16 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 13:53 [PATCH] selftests: filesystems: fix warn_unused_result build warnings Abhinav Jain
2024-08-16 13:11 ` Shuah Khan [this message]
2024-09-03 17:45   ` Shuah Khan
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 18:49 Amer Al Shanawany
2024-04-19 16:41 ` Muhammad Usama Anjum
2024-05-04 17:17   ` Amer Al Shanawany
2024-06-03 11:17     ` Amer Al Shanawany
2024-06-11 15:23       ` Shuah Khan

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=5fd97d54-fa64-4c03-865f-961ed4596a6e@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=brauner@kernel.org \
    --cc=jain.abhinav177@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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