From: Petr Vorel <pvorel@suse.cz>
To: linuxtestproject.agent@gmail.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] tst_assert: Use 'long long' to fix 32bit compat mode truncation
Date: Tue, 22 Sep 2026 09:35:19 +0200 [thread overview]
Message-ID: <20260922073519.GA2146856@pevik> (raw)
In-Reply-To: <20260918170642.4762-1-linuxtestproject.agent@gmail.com>
Hi all,
> Hi Andrea,
> On Fri, 18 Sep 2026, Andrea Cervesato wrote:
> > [PATCH 1/2] tst_assert: Use 'long long' to fix 32bit compat mode truncation
> --- [PATCH 1/2] ---
> > - if (val == sys_val) {
> > + if (val == (unsigned long)sys_val) {
> > tst_res_(file, lineno, TPASS, "%s = %lu", path, val);
> > return;
> > }
> > - tst_res_(file, lineno, TFAIL, "%s != %lu got %lu", path, val, sys_val);
> > + tst_res_(file, lineno, TFAIL, "%s != %lu got %lu",
> > + path, val, (unsigned long)sys_val);
> Casting sys_val to unsigned long causes false passes on 32-bit systems
> whenever sys_val exceeds ULONG_MAX and (sys_val & 0xFFFFFFFF) equals val,
> while masking the actual value read in the failure log. Compare
> val == sys_val directly and report sys_val with %llu on mismatch;
> compat-mode truncation should be handled in test-specific code instead of
> altering generic assertion semantics.
I don't understand why casting is problem when the original code used unsigned
long for sys_val.
- unsigned long sys_val;
+ unsigned long long sys_val;
=> I would say agent is wrong.
But the suggestion to modify the behavior for all tests due single 32bit mode
failure is something to be considered.
@Li @Cyril WDYT? Is this patchset safe, or we use the one contributed by Wei?
Other option would be to handle everything with custom code in shmctl03.c
(wait for library helper until it's really needed).
Also, if we change tst_assert(), do we want to somehow document in the kerneldoc
that code is ready for 32bit?
Kind regards,
Petr
> 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
next prev parent reply other threads:[~2026-09-22 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 12:50 [LTP] [PATCH 0/2] shmctl03 fix on 32bit compat mode Petr Vorel
2026-09-18 12:50 ` [LTP] [PATCH 1/2] tst_assert: Use 'long long' to fix 32bit compat mode truncation Petr Vorel
2026-09-18 17:06 ` [LTP] " linuxtestproject.agent
2026-09-22 7:35 ` Petr Vorel [this message]
2026-09-18 12:50 ` [LTP] [PATCH 2/2] shmctl03: Fix shmmax clamped to INT_MAX in 32bit compat mode Petr Vorel
2026-09-23 11:11 ` Cyril Hrubis
2026-09-24 11:03 ` Petr Vorel
-- strict thread matches above, loose matches on Subject: below --
2026-09-24 11:25 [LTP] [PATCH v2 1/3] tst_assert: Use 'long long' to fix 32bit compat mode truncation Petr Vorel
2026-09-24 13:24 ` [LTP] " linuxtestproject.agent
2026-09-25 6:55 ` Petr Vorel
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=20260922073519.GA2146856@pevik \
--to=pvorel@suse.cz \
--cc=linuxtestproject.agent@gmail.com \
--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