BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sean Young" <sean@mess.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: convert lirc_mode2 to prog_tests and extend coverage
Date: Thu, 20 Aug 2026 18:05:04 +0000	[thread overview]
Message-ID: <20260820180505.41D251F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820175154.708374-1-sean@mess.org>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Missing `globfree()` when `glob()` returns an error in `find_loopback_devices`.
- [Low] Orphaned test file `test_lirc_mode2_user.c` left in the source tree.
- [Low] Multi-line comment formatting violates BPF subsystem guidelines.
--

--- Patch [1]: [PATCH] selftests/bpf: convert lirc_mode2 to prog_tests and extend coverage ---
commit 932c1322ffc2d27251b53c4449db5c4ec36061e6
Author: Sean Young <sean@mess.org>

selftests/bpf: convert lirc_mode2 to prog_tests and extend coverage

While porting, extend coverage of the BPF_LIRC_MODE2 attach/detach/
query API:

[ ... ]

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 2b2f93dec474b..f8ec0f574559a 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> @@ -141,7 +140,6 @@ TEST_GEN_PROGS_EXTENDED = \
>  	bench \
>  	flow_dissector_load \
>  	test_cpp \
> -	test_lirc_mode2_user \
>  	veristat \

[Severity: Low]
This isn't a bug, but it looks like tools/testing/selftests/bpf/test_lirc_mode2_user.c
was removed from the Makefile here but not deleted from the source tree. Should
that file be deleted as part of this patch?

[ ... ]
> diff --git a/tools/testing/selftests/bpf/prog_tests/lirc_mode2.c b/tools/testing/selftests/bpf/prog_tests/lirc_mode2.c
> new file mode 100644
> index 0000000000000..17a38cd03845c
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/lirc_mode2.c
> @@ -0,0 +1,328 @@
[ ... ]
> +/* Read the DEVNAME= line out of the first uevent file that matches
> + * pattern, and turn it into a /dev/<name> path.
> + */
> +static bool find_devname(const char *pattern, char *path, size_t path_sz)

[Severity: Low]
This isn't a bug, but does this violate the BPF subsystem multi-line comment
style guidelines? The opening /* should probably be on its own line:

/*
 * Read the DEVNAME= line out of the first uevent file that matches
 * pattern, and turn it into a /dev/<name> path.
 */

[ ... ]
> +/* Load rc-loopback and find the lirc and input chardevs it created. */
> +static bool find_loopback_devices(char *lirc_path, char *input_path,
> +				  size_t path_sz)
> +{
> +	glob_t gl = {};
> +	bool found = false;
> +
> +	/* Ignore failure, we check for the resulting devices below. */
> +	system("modprobe rc-loopback > /dev/null 2>&1");
> +
> +	if (glob("/sys/class/rc/rc*", 0, NULL, &gl)) {
> +		fprintf(stderr, "No rc devices found, is CONFIG_RC_LOOPBACK enabled?\n");
> +		return false;
> +	}

[Severity: Medium]
Could this leak memory if glob() returns an error like GLOB_NOMATCH? Some
implementations of glob() may allocate memory for gl_pathv even on error paths.
Should there be a call to globfree(&gl) before returning false?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820175154.708374-1-sean@mess.org?part=1

  reply	other threads:[~2026-08-20 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 17:51 [PATCH] selftests/bpf: convert lirc_mode2 to prog_tests and extend coverage Sean Young
2026-08-20 18:05 ` sashiko-bot [this message]
2026-08-20 18:46 ` bot+bpf-ci

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=20260820180505.41D251F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sean@mess.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