Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c
@ 2026-07-17  6:25 longlong yan
  2026-07-22 19:36 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: longlong yan @ 2026-07-17  6:25 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, shuah, netdev,
	linux-kselftest, linux-kernel
  Cc: longlong yan

The ARRAY_SIZE macro is more compact and more formal in linux source.

Fixes: fcd7132cb1f9 ("selftests/net: test sk_filter support for SKF_NET_OFF on frags")
Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
---
 tools/testing/selftests/net/skf_net_off.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/skf_net_off.c b/tools/testing/selftests/net/skf_net_off.c
index 1fdf61d6cd7f..d4e38d326c39 100644
--- a/tools/testing/selftests/net/skf_net_off.c
+++ b/tools/testing/selftests/net/skf_net_off.c
@@ -46,6 +46,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include "kselftest.h"
 
 static bool cfg_do_filter;
 static bool cfg_do_frags;
@@ -92,7 +93,7 @@ static void sk_set_filter(int fd)
 	};
 
 	struct sock_fprog filter = {
-		sizeof(filter_code) / sizeof(filter_code[0]),
+		ARRAY_SIZE(filter_code),
 		filter_code,
 	};
 
@@ -159,7 +160,7 @@ static void tun_write(int fd)
 	iov[4].iov_base = &payload;
 	iov[4].iov_len  = sizeof(payload);
 
-	ret = writev(fd, iov, sizeof(iov) / sizeof(iov[0]));
+	ret = writev(fd, iov, ARRAY_SIZE(iov));
 	if (ret <= 0)
 		error(1, errno, "writev");
 }
@@ -183,7 +184,7 @@ static void raw_read(int fd)
 	iov[1].iov_len = sizeof(payload);
 
 	msg.msg_iov = iov;
-	msg.msg_iovlen = sizeof(iov) / sizeof(iov[0]);
+	msg.msg_iovlen = ARRAY_SIZE(iov);
 
 	ret = recvmsg(fd, &msg, 0);
 	if (ret <= 0)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c
  2026-07-17  6:25 [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c longlong yan
@ 2026-07-22 19:36 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-07-22 19:36 UTC (permalink / raw)
  To: longlong yan
  Cc: davem, edumazet, pabeni, horms, shuah, netdev, linux-kselftest,
	linux-kernel

On Fri, 17 Jul 2026 14:25:02 +0800 longlong yan wrote:
> The ARRAY_SIZE macro is more compact and more formal in linux source.
> 
> Fixes: fcd7132cb1f9 ("selftests/net: test sk_filter support for SKF_NET_OFF on frags")
> Signed-off-by: longlong yan <yanlonglong@kylinos.cn>

Waste of time. Please don't send any more networking patches in this
release.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-22 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  6:25 [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c longlong yan
2026-07-22 19:36 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox