From: sashiko-bot@kernel.org
To: "Tianyi Chen" <hi@tychen.cc>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf] selftests/bpf: Check returned keys in map batch validators
Date: Sun, 06 Sep 2026 14:45:23 +0000 [thread overview]
Message-ID: <20260906144524.0DCE91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906143918.848536-1-hi@tychen.cc>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch introduces new usages of the deprecated CHECK() macro instead of the modern ASSERT_*() macros, violating BPF subsystem selftest guidelines.
--
commit a52968798d334a652d5c678ee6009b5d4bc96738
Author: Tianyi Chen <hi@tychen.cc>
selftests/bpf: Check returned keys in map batch validators
This commit updates map batch validators for hash and array maps by
indexing the visited array by key and verifying that returned keys fall
within the valid range. This prevents duplicate keys with matching values
from hiding missing entries.
> diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
> index b595556315bc3..76d3800a82af9 100644
> --- a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
> +++ b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
> @@ -45,6 +45,9 @@ static void map_batch_verify(int *visited, __u32 max_entries, int *keys,
>
> memset(visited, 0, max_entries * sizeof(*visited));
> for (i = 0; i < max_entries; i++) {
> + CHECK(keys[i] < 0 || keys[i] >= max_entries, "key checking",
> + "error: i %d key %d out of range\n", i, keys[i]);
> +
[Severity: Low]
Could this use the modern ASSERT_*() macros instead of the deprecated
CHECK() macro?
[ ... ]
> diff --git a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c
> index 5da493b94ae25..430949f9691d7 100644
> --- a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c
> +++ b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c
> @@ -50,6 +50,8 @@ static void map_batch_verify(int *visited, __u32 max_entries,
>
> memset(visited, 0, max_entries * sizeof(*visited));
> for (i = 0; i < max_entries; i++) {
> + CHECK(keys[i] < 1 || keys[i] > max_entries, "key checking",
> + "error: i %d key %d out of range\n", i, keys[i]);
[Severity: Low]
Could this also use the modern ASSERT_*() macros rather than CHECK()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260906143918.848536-1-hi@tychen.cc?part=1
next prev parent reply other threads:[~2026-09-06 14:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 14:39 [PATCH bpf] selftests/bpf: Check returned keys in map batch validators Tianyi Chen
2026-09-06 14:45 ` sashiko-bot [this message]
2026-09-06 15:37 ` Tianyi Chen
2026-09-06 15:14 ` bot+bpf-ci
2026-09-06 15:37 ` Tianyi Chen
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=20260906144524.0DCE91F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=hi@tychen.cc \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.