From: longlong yan <yanlonglong@kylinos.cn>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: longlong yan <yanlonglong@kylinos.cn>
Subject: [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c
Date: Fri, 17 Jul 2026 14:25:02 +0800 [thread overview]
Message-ID: <20260717062502.1016-1-yanlonglong@kylinos.cn> (raw)
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
next reply other threads:[~2026-07-17 6:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 6:25 longlong yan [this message]
2026-07-22 19:36 ` [PATCH] selftests/net: use ARRAY_SIZE macro in skf_net_off.c Jakub Kicinski
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=20260717062502.1016-1-yanlonglong@kylinos.cn \
--to=yanlonglong@kylinos.cn \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--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