public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: jiaying.song.cn@windriver.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/time01:Avoid using TST_RET in time() test to support Y2038-safe time_t
Date: Fri, 7 Nov 2025 13:19:35 +0100	[thread overview]
Message-ID: <20251107121935.GA1126593@pevik> (raw)
In-Reply-To: <20251020111315.2338881-1-jiaying.song.cn@windriver.com>

Hi Jiaying,

> On 32-bit systems with Y2038 support, time_t is 64-bit while TST_RET
> remains a long (usually 32-bit).Using TST_RET to store the return value
> of time() causes overflow after 2038, leading to incorrect comparisons
> and false test failures like:

>     TFAIL: time() returned value -2085977741, stored value 2208989555 are different

> This patch replaces usage of TST_RET with a local variable of type
> time_t (ret_time), ensuring correct behavior with large timestamps and
> avoiding truncation.

+1

...
> +++ b/testcases/kernel/syscalls/time/time01.c
> @@ -23,24 +23,23 @@ static time_t *targs[] = {
>  static void verify_time(unsigned int i)
>  {
>  	time_t *tloc = targs[i];
> +        time_t ret_time = time(tloc);

> -	TEST(time(tloc));

nit: wrong whitespace indent (can be fixed before merge).

Fixed that and merged.

Thanks!

Kind regards,
Petr

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

  reply	other threads:[~2025-11-07 12:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 11:13 [LTP] [PATCH] syscalls/time01:Avoid using TST_RET in time() test to support Y2038-safe time_t Jiaying Song via ltp
2025-11-07 12:19 ` Petr Vorel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-05-19  6:49 Jiaying Song via ltp
2025-09-19 16:05 ` Cyril Hrubis

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=20251107121935.GA1126593@pevik \
    --to=pvorel@suse.cz \
    --cc=jiaying.song.cn@windriver.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