BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: pdsj2807@gmail.com
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: remove unused duration variable from cgroup_attach_multi
Date: Thu, 15 Oct 2026 17:54:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-173267@kernel.org> (raw)
In-Reply-To: <20261015175022.1370503-1-pdsj2807@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests/bpf: build failure from removing duration required by CHECK macro
--

commit d7de4f4763b56d10ac8f8dca1287b007d98057b7
Author: Palak Raval <pdsj2807@gmail.com>

selftests/bpf: remove unused duration variable from cgroup_attach_multi

This commit removes the duration variable from serial_test_cgroup_attach_multi()
under the assumption that it is unused.

> diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c
> index db0b7bac78d15..9037e98f6f760 100644
> --- a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c
> +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c
> @@ -81,7 +81,6 @@ void serial_test_cgroup_attach_multi(void)
>  	DECLARE_LIBBPF_OPTS(bpf_prog_attach_opts, attach_opts);
>  	int allow_prog[7] = {-1};
>  	unsigned long long value;
> -	__u32 duration = 0;
>  	int i = 0;
>  
>  	for (i = 0; i < ARRAY_SIZE(allow_prog); i++) {

[Severity: Low]
Will removing this variable cause a build failure? 

The BPF selftest framework's deprecated CHECK() macro implicitly requires the
duration variable to be present in the caller's scope, as it expands to
_CHECK(condition, tag, duration, format...).

Because serial_test_cgroup_attach_multi() uses CHECK() right below this, and
extensively throughout its body:

	for (i = 0; i < ARRAY_SIZE(allow_prog); i++) {
		allow_prog[i] = prog_load_cnt(1, 1 << i);
		if (CHECK(allow_prog[i] < 0, "prog_load",
			  "verifier output:\n%s\n-------\n", bpf_log_buf))
			goto err;
	}

removing the duration variable causes an undeclared identifier compilation
error.

To safely remove the duration variable, the test must first be migrated to the
modern ASSERT_*() macros.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015175022.1370503-1-pdsj2807@gmail.com?part=1

      reply	other threads:[~2026-10-15 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 17:50 [PATCH] selftests/bpf: remove unused duration variable from cgroup_attach_multi pdsj2807
2026-10-15 17:54 ` sashiko-bot [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=sashiko-outbox-173267@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=pdsj2807@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox