Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] fsconfig04: Check FSCONFIG_SET_PATH
Date: Wed, 10 Jun 2026 10:06:10 +0000	[thread overview]
Message-ID: <20260610100611.4082-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260610052132.2727-1-wegao@suse.com>

Hi Wei,

On Wed, 10 Jun 2026 05:21:25 +0000, Wei Gao wrote:
> fsconfig04: Check FSCONFIG_SET_PATH

> +	TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", dev0, 0));
> +	if (TST_RET == -1) {
> +		tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
> +		SAFE_CLOSE(fd);
> +		return;
> +	}

FSCONFIG_SET_STRING is not the subject of this test -- it is
infrastructure needed before the FSCONFIG_SET_PATH call under test.
If it fails, the test cannot proceed, so it should be reported as
TBROK, not TFAIL.

Using tst_brk(TBROK | TTERRNO, ...) would also simplify this block
because cleanup() already closes fd, making the explicit SAFE_CLOSE
unnecessary:

	TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", dev0, 0));
	if (TST_RET == -1)
		tst_brk(TBROK | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");

> +	unsigned int major, minor, device_num;
> +	unsigned int found = 0;
> +
> +	SAFE_SSCANF(dev2, "/dev/%s", loop_name);
> +
> +	snprintf(path, sizeof(path), "/sys/block/%s/dev", loop_name);
> +	SAFE_FILE_SCANF(path, "%u:%u", &major, &minor);
> +	device_num = (major << 8) | minor;
> +	snprintf(device_str, sizeof(device_str), "0x%04x", device_num);

The encoding (major << 8) | minor only matches the kernel's
new_encode_dev() when minor < 256. For minor >= 256 the kernel
stores (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12),
which is what tune2fs prints.

On a system with many loop devices in use the test could get a
loop device with minor >= 256, causing the computed string to
differ from tune2fs output and producing a false TFAIL.

Consider something like:

	device_num = (minor & 0xff) | (major << 8)
		| ((minor & ~0xff) << 12);

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 10:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 15:10 [LTP] [PATCH v1] fsconfig04.c: Check FSCONFIG_SET_PATH Wei Gao via ltp
2025-05-22 20:56 ` Petr Vorel
2025-05-26 14:29   ` Wei Gao via ltp
2025-05-26  6:40     ` Petr Vorel
2025-05-26 14:35 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-05-26  9:54   ` Petr Vorel
2025-05-26 12:54     ` Cyril Hrubis
2025-05-26 16:13       ` Petr Vorel
2025-05-27  8:24         ` Cyril Hrubis
2025-05-27  8:58           ` [LTP] LTP doc: test examples [was: Re: [PATCH v2] fsconfig04.c: Check FSCONFIG_SET_PATH] Petr Vorel
2025-05-26 14:38   ` [LTP] [PATCH v2] fsconfig04.c: Check FSCONFIG_SET_PATH Cyril Hrubis
2025-06-03 21:45   ` [LTP] [PATCH v3] " Wei Gao via ltp
2025-10-17  4:39     ` Wei Gao via ltp
2025-12-12  9:29     ` Andrea Cervesato via ltp
2026-02-25  9:27       ` Wei Gao via ltp
2026-03-16  8:49         ` Petr Vorel
2026-03-17  0:59           ` Wei Gao via ltp
2026-03-24 12:50           ` Petr Vorel
2026-04-10  5:47     ` [LTP] [PATCH v4] " Wei Gao via ltp
2026-04-16 11:25       ` [LTP] [PATCH v5] fsconfig04: " Wei Gao via ltp
2026-04-16 13:52         ` [LTP] " linuxtestproject.agent
2026-04-16 13:55           ` Andrea Cervesato via ltp
2026-04-30  5:19         ` [LTP] [PATCH v6] " Wei Gao via ltp
2026-04-30  6:34           ` [LTP] " linuxtestproject.agent
2026-05-07 12:25             ` Wei Gao via ltp
2026-06-09  9:44           ` [LTP] [PATCH v6] " Andrea Cervesato via ltp
2026-06-10  5:21           ` [LTP] [PATCH v7] " Wei Gao via ltp
2026-06-10 10:06             ` linuxtestproject.agent [this message]
2026-06-18  2:38             ` [LTP] [PATCH v8] " Wei Gao via ltp
2026-06-18  4:04               ` [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=20260610100611.4082-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /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