netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nai-Chen Cheng <bleach1827@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev,
	 Nai-Chen Cheng <bleach1827@gmail.com>
Subject: [PATCH] selftests/net: fix unused return value warnings in ksft.h
Date: Sat, 06 Sep 2025 23:59:28 +0800	[thread overview]
Message-ID: <20250906-selftests-net-ksft-v1-1-f1577cea3f68@gmail.com> (raw)

The write() and read() system calls in ksft_ready() and ksft_wait()
functions return values that were not being checked, causing complier
warnings with GCC.

Fix the warnings by casting the return values to void to indicate that
ignoring them is intentional.

Signed-off-by: Nai-Chen Cheng <bleach1827@gmail.com>
---
 tools/testing/selftests/net/lib/ksft.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/lib/ksft.h b/tools/testing/selftests/net/lib/ksft.h
index 17dc34a612c64e549f634e82a23f317b2ff6a282..0ca2cb408c643bc76c0aaea684f0e7e28e6b05a6 100644
--- a/tools/testing/selftests/net/lib/ksft.h
+++ b/tools/testing/selftests/net/lib/ksft.h
@@ -10,6 +10,7 @@ static inline void ksft_ready(void)
 {
 	const char msg[7] = "ready\n";
 	char *env_str;
+	ssize_t ret;
 	int fd;
 
 	env_str = getenv("KSFT_READY_FD");
@@ -24,7 +25,8 @@ static inline void ksft_ready(void)
 		fd = STDOUT_FILENO;
 	}
 
-	write(fd, msg, sizeof(msg));
+	ret = write(fd, msg, sizeof(msg));
+	(void)ret;
 	if (fd != STDOUT_FILENO)
 		close(fd);
 }
@@ -33,6 +35,7 @@ static inline void ksft_wait(void)
 {
 	char *env_str;
 	char byte;
+	ssize_t ret;
 	int fd;
 
 	env_str = getenv("KSFT_WAIT_FD");
@@ -48,7 +51,8 @@ static inline void ksft_wait(void)
 		fd = STDIN_FILENO;
 	}
 
-	read(fd, &byte, sizeof(byte));
+	ret = read(fd, &byte, sizeof(byte));
+	(void)ret;
 	if (fd != STDIN_FILENO)
 		close(fd);
 }

---
base-commit: d1d10cea0895264cc3769e4d9719baa94f4b250b
change-id: 20250906-selftests-net-ksft-37266937bc4d

Best regards,
-- 
Nai-Chen Cheng <bleach1827@gmail.com>


             reply	other threads:[~2025-09-06 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-06 15:59 Nai-Chen Cheng [this message]
2025-09-09  1:20 ` [PATCH] selftests/net: fix unused return value warnings in ksft.h Jakub Kicinski
2025-09-09 10:00   ` Nai-Chen(Simone) Cheng
2025-09-09 23:25     ` Jakub Kicinski
2025-09-10 11:16       ` Nai-Chen(Simone) Cheng

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=20250906-selftests-net-ksft-v1-1-f1577cea3f68@gmail.com \
    --to=bleach1827@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).