All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] futex_wake04: avoid tst_ts_from_ns overflow on 32-bit platforms
Date: Wed, 9 Jun 2021 15:38:05 +0200	[thread overview]
Message-ID: <YMDEPYSWZG5FzUTi@yuki> (raw)
In-Reply-To: <YMCkB/iS54OJaby4@mussarela>

Hi!
> > Good catch, I guess that it would be slightly cleaner to fix the
> > NSEC_PER_SEC size instead with:
> > 
> > diff --git a/include/lapi/common_timers.h b/include/lapi/common_timers.h
> > index b783beff4..e50f698d6 100644
> > --- a/include/lapi/common_timers.h
> > +++ b/include/lapi/common_timers.h
> > @@ -12,7 +12,7 @@
> >  #include "lapi/posix_clocks.h"
> > 
> >  #ifndef NSEC_PER_SEC
> > -#define NSEC_PER_SEC (1000000000L)
> > +#define NSEC_PER_SEC (1000000000LL)
> >  #endif
> > 
> >  static const clock_t clock_list[] = {
> > 
> > 
> > What do you think?
> > 
> > -- 
> > Cyril Hrubis
> > chrubis@suse.cz
> 
> Yeah, I even wrote and tested that it would build, but I wasn't able to go
> through any build logs or run complete tests.
> 
> But maybe I am just overthinking this, and any promotions due to this would
> only fix issues and not introduce any new ones.

That would be my expectation.

> Well, on second thought, on 32-bit, in cases like variadic functions, it could
> cause a problem. So, I am just afraid that applying this fix without looking
> for every use of NSEC_PER_SEC might lead to new bugs.

Having a look at 'git grep NSEC_PER_SEC' there are five uses of
NSEC_PER_SEC and all of these should be, as far as I can tell, safe.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-06-09 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 13:27 [LTP] [PATCH] futex_wake04: avoid tst_ts_from_ns overflow on 32-bit platforms Thadeu Lima de Souza Cascardo
2021-06-09  8:23 ` Cyril Hrubis
2021-06-09 11:20   ` Thadeu Lima de Souza Cascardo
2021-06-09 13:38     ` Cyril Hrubis [this message]
2021-06-09 14:22       ` Thadeu Lima de Souza Cascardo
2021-06-09 14:09         ` 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=YMDEPYSWZG5FzUTi@yuki \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.