From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "longlong yan" <yanlonglong@kylinos.cn>, <bpf@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<andrii@kernel.org>, <daniel@iogearbox.net>,
<martin.lau@linux.dev>
Subject: Re: [PATCH] libarena/selftests: use ARRAY_SIZE macro in st_asan_buddy.bpf.c
Date: Fri, 17 Jul 2026 00:00:58 -0400 [thread overview]
Message-ID: <DK0JOQQU3K98.3P9DW8576WMEI@etsalapatis.com> (raw)
In-Reply-To: <20260716071110.560-1-yanlonglong@kylinos.cn>
On Thu Jul 16, 2026 at 3:11 AM EDT, longlong yan wrote:
> The ARRAY_SIZE macro is more compact and more formal in linux source.
>
> Fixes: b1487dc1b181 ("selftests/bpf: Add selftests for libarena buddy allocator")
> Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
> ---
> .../selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c
> index 3266a28f53d7..9c94a5167a50 100644
> --- a/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c
> +++ b/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c
> @@ -163,7 +163,7 @@ __weak int asan_test_buddy_oob(void)
> return ret;
> }
>
> - for (i = zero; i < sizeof(sizes) / sizeof(sizes[0]) && can_loop; i++) {
> + for (i = zero; i < ARRAY_SIZE(sizes) && can_loop; i++) {
> barrier_var(i);
> ret = asan_test_buddy_oob_single(sizes[i]);
> if (ret) {
> @@ -201,7 +201,7 @@ __weak int asan_test_buddy_uaf(void)
> return ret;
> }
>
> - for (i = zero; i < sizeof(sizes) / sizeof(sizes[0]) && can_loop; i++) {
> + for (i = zero; i < ARRAY_SIZE(sizes) && can_loop; i++) {
> barrier_var(i);
> ret = asan_test_buddy_uaf_single(sizes[i]);
> if (ret) {
As the bot says, this doesn't compile. The sizeof(array) /
sizeof(array[0]) is only present in libarena for selftests, so I
it's not worth bringing in the macro or adding extra headers even if
it makes the code nicer.
pw-bot: cr
prev parent reply other threads:[~2026-07-17 4:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 7:11 [PATCH] libarena/selftests: use ARRAY_SIZE macro in st_asan_buddy.bpf.c longlong yan
2026-07-16 7:23 ` sashiko-bot
2026-07-17 4:00 ` Emil Tsalapatis [this message]
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=DK0JOQQU3K98.3P9DW8576WMEI@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=yanlonglong@kylinos.cn \
/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