Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] fw_load: Modernize ltp_fw_load kernel module
Date: Wed, 10 Jun 2026 19:44:27 +0000	[thread overview]
Message-ID: <20260610194427.4063-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260610-fw_load-v3-1-eef32edfe8d5@suse.com>

Hi Andrea,

On Wed, Jun 10 2026, Andrea Cervesato wrote:
> fw_load: Modernize ltp_fw_load kernel module

--- [PATCH 2/3] ---

> +static void cleanup(void)
> +{
> +	struct fw_data *fw;
> +
> +	for (int i = fw_count - 1; i >= 0; i--) {
> +		fw = &firmware[i];
> +
> +		if (access(fw->file, F_OK) != -1)
> +			SAFE_UNLINK(fw->file);
> +
> +		if (access(fw->dir, F_OK) != -1)
> +			remove(fw->dir);
> +	}

The old code tracked whether each directory was created by the test
(the `remove_dir` flag) and only removed directories the test itself
made. The new code unconditionally attempts `remove()` on every
directory in the `firmware[]` array.

If a directory such as `/lib/firmware/updates/` existed before the
test and happened to be empty after the test file is unlinked,
`remove()` would delete it even though the test did not create it.

Could a flag (or an `access()` check before `SAFE_MKDIR`) be added
to restore the previous behaviour?

--- [PATCH 3/3] ---

> + * [Algorithm]
> + *
> + * - Set the firmware search path to the LTP temporary directory
> + * - Create ``FW_NUM - 1`` firmware files there, each named
> + *   ``n<i>_load_tst.fw`` and filled with a known byte pattern
> + * - Add one fake firmware entry that has no file on disk
> + * - Load the helper module with ``fw_size`` matching the blob size

The algorithm says the module is loaded after the firmware files are
created, but the code loads the module before creating the files
(lines 115-119). The order does not affect correctness since
`request_firmware()` is only triggered when writing to `fwnum`, but
the `[Algorithm]` section should match the actual code order.

Verdict: Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-06-10 19:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 17:07 [LTP] [PATCH v3 0/3] Rewrite fw_load test using new API Andrea Cervesato
2026-06-10 17:07 ` [LTP] [PATCH v3 1/3] fw_load: Modernize ltp_fw_load kernel module Andrea Cervesato
2026-06-10 19:44   ` linuxtestproject.agent [this message]
2026-06-10 17:07 ` [LTP] [PATCH v3 2/3] firmware/fw_load: rewrite firmware loading test using new LTP API Andrea Cervesato
2026-06-10 17:07 ` [LTP] [PATCH v3 3/3] firmware/fw_load: add fw_load02 for custom firmware path Andrea Cervesato
  -- strict thread matches above, loose matches on Subject: below --
2026-06-15 12:12 [LTP] [PATCH v7 1/4] fw_load: Modernize ltp_fw_load kernel module Andrea Cervesato
2026-06-15 13:21 ` [LTP] " linuxtestproject.agent
2026-06-11 13:44 [LTP] [PATCH v6 1/4] " Andrea Cervesato
2026-06-11 14:44 ` [LTP] " linuxtestproject.agent
2026-06-10 13:50 [LTP] [PATCH v2 1/3] " Andrea Cervesato
2026-06-10 17:03 ` [LTP] " linuxtestproject.agent
2026-06-10 12:51 [LTP] [PATCH 1/3] " Andrea Cervesato
2026-06-10 13:27 ` [LTP] " linuxtestproject.agent

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=20260610194427.4063-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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