All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Prarit Bhargava <prarit@redhat.com>
Subject: Re: [PATCH 4/6] time: Avoid undefined behaviour in timespec64_add_safe()
Date: Thu, 1 Sep 2016 10:02:55 +0200	[thread overview]
Message-ID: <20160901080255.GA2386@localhost.localdomain> (raw)
In-Reply-To: <1472680222-21060-5-git-send-email-john.stultz@linaro.org>

On Wed, Aug 31, 2016 at 02:50:20PM -0700, John Stultz wrote:
>     UBSAN: Undefined behaviour in kernel/time/time.c:783:2
>     signed integer overflow:
>     5273 + 9223372036854771711 cannot be represented in type 'long int'

...

> Line 783 is this:
> 
> 783         set_normalized_timespec64(&res, lhs.tv_sec + rhs.tv_sec,
> 784                         lhs.tv_nsec + rhs.tv_nsec);

...

> Note that this is not currently a huge concern since the kernel should be
> built with -fno-strict-overflow by default, but could be a problem in the
> future, a problem with older compilers, or other compilers than gcc.

Is this really a concern at all?  The value 9223372036854771711 is a
huge number of seconds.

Thanks,
Richard

  reply	other threads:[~2016-09-01  8:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31 21:50 [GIT PULL][PATCH 0/6] 4.9 timekeeping changes for tip/timers/core John Stultz
2016-08-31 21:50 ` [PATCH 1/6] hrtimer: Spelling fixes John Stultz
2016-08-31 21:50 ` [PATCH 2/6] clocksource: Defer override invalidation unless clock is unstable John Stultz
2016-08-31 21:50 ` [PATCH 3/6] timekeeping: Prints the amounts of time spent during suspend John Stultz
2016-08-31 21:50 ` [PATCH 4/6] time: Avoid undefined behaviour in timespec64_add_safe() John Stultz
2016-09-01  8:02   ` Richard Cochran [this message]
2016-09-01  9:37     ` Vegard Nossum
2016-08-31 21:50 ` [PATCH 5/6] time: Avoid undefined behaviour in ktime_add_safe() John Stultz
2016-08-31 21:50 ` [PATCH 6/6] time: alarmtimer: Add tracepoints for alarmtimers John Stultz

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=20160901080255.GA2386@localhost.localdomain \
    --to=richardcochran@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=prarit@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vegard.nossum@oracle.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 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.