Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] tst_test: Add needs_cpu_vendor to struct tst_test
Date: Tue,  9 Jun 2026 15:59:17 +0000	[thread overview]
Message-ID: <20260609155917.3996-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260609143237.1246776-1-chrubis@suse.cz>

Hi Cyril,

On Tue, 9 Jun 2026 16:32:37 +0200, Cyril Hrubis wrote:
> tst_test: Add needs_cpu_vendor to struct tst_test

> This adds a generic implementaiton of needs_cpu_vendor to the tst_test

Typo: "implementaiton" -> "implementation".

> +const char *tst_cpu_vendor(void)
> +{
> +	static char cpu_vendor[16];
> ...
> +	ret = FILE_LINES_SCANF(NULL, "/proc/cpuinfo", "vendor_id : %16s[^\n]", cpu_vendor);

Two issues with the scanf format:

1) The width specifier %16s allows writing up to 16 characters plus
a NUL terminator into a 16-byte buffer, which is a one-byte overflow.
Should be %15s.

2) The [^\n] after %16s is treated as literal text to match, not as a
scanset. It is effectively dead and does not do what it looks like it
should. Either drop it, or if the intent was to match characters
including spaces use %15[^\n] as the conversion specifier (but vendor_id
values are single words so %15s should be fine).

> +	if (tst_test->needs_cpu_vendor && strcmp(tst_test->needs_cpu_vendor, tst_cpu_vendor())) {
> +		tst_brk(TCONF, "Tests needs '%s' CPU to continue have '%s'",
> +			tst_test->needs_cpu_vendor, tst_cpu_vendor());
> +	}

The message has a grammar issue. Something like
"Test needs '%s' CPU, have '%s'" would read better.

> diff --git a/include/tst_cpu.h b/include/tst_cpu.h
> ...
> +
> +
> +
>  #endif	/* TST_CPU_H__ */

Two extra blank lines were added before #endif.

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

      parent reply	other threads:[~2026-06-09 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 14:32 [LTP] [PATCH] tst_test: Add needs_cpu_vendor to struct tst_test Cyril Hrubis
2026-06-09 15:02 ` Jan Stancek via ltp
2026-06-10  8:16   ` Cyril Hrubis
2026-06-11 10:20   ` Cyril Hrubis
2026-06-09 15:59 ` linuxtestproject.agent [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=20260609155917.3996-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=chrubis@suse.cz \
    --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