From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755199AbcIAIEe (ORCPT ); Thu, 1 Sep 2016 04:04:34 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38793 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754887AbcIAIDB (ORCPT ); Thu, 1 Sep 2016 04:03:01 -0400 Date: Thu, 1 Sep 2016 10:02:55 +0200 From: Richard Cochran To: John Stultz Cc: lkml , Vegard Nossum , Thomas Gleixner , Ingo Molnar , Prarit Bhargava Subject: Re: [PATCH 4/6] time: Avoid undefined behaviour in timespec64_add_safe() Message-ID: <20160901080255.GA2386@localhost.localdomain> References: <1472680222-21060-1-git-send-email-john.stultz@linaro.org> <1472680222-21060-5-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1472680222-21060-5-git-send-email-john.stultz@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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