mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Wake Liu <wakel@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	 Andy Lutomirski <luto@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vdso: Define NSEC_PER_SEC as 64-bit to prevent overflow
Date: Sun, 10 Aug 2025 10:28:44 +0200	[thread overview]
Message-ID: <fbb55063-ab03-40a9-80f4-4315d12239ba@t-8ch.de> (raw)
In-Reply-To: <87wm7bbo3c.ffs@tglx>

Hi Wake,

On 2025-08-10 10:03:19+0200, Thomas Gleixner wrote:
> On Sat, Aug 09 2025 at 17:49, Wake Liu wrote:
> > long long timespec_sub(struct timespec a, struct timespec b)
> > {
> > long long ret = NSEC_PER_SEC * b.tv_sec + b.tv_nsec;
> >
> > ret -= NSEC_PER_SEC * a.tv_sec + a.tv_nsec;
> > return ret;
> > }

(...)

> And please make that an inline function and put it into a header file in
> the timer selftest directory, and replace _all_ copies of it in the
> various timer tests.

When you create that header file, please add a dedicated definition
of NSEC_PER_SEC to it. The selftests shouldn't be using internal kernel
headers in the first place. Especially not for a single, trivial constant.


Thomas

  reply	other threads:[~2025-08-10  8:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 16:21 Wake Liu
2025-08-06  8:44 ` Thomas Gleixner
2025-08-06  8:55 ` Thomas Gleixner
2025-08-09  9:49   ` Wake Liu
2025-08-10  8:03     ` Thomas Gleixner
2025-08-10  8:28       ` Thomas Weißschuh [this message]
2025-09-15 19:19         ` [PATCH v2] selftests/timers: Consolidate and fix 32-bit overflow in timespec_sub Wake Liu
2025-09-21  7:49           ` Thomas Gleixner
2026-01-07 23:19             ` Carlos Llamas
2025-08-06 20:28 ` [PATCH] vdso: Define NSEC_PER_SEC as 64-bit to prevent overflow kernel test robot
2025-08-07  7:37 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-08-05 16:20 Wake Liu

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=fbb55063-ab03-40a9-80f4-4315d12239ba@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    --cc=wakel@google.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

all inboxes | Powered by JetHome®