From patchwork Wed Jul 15 06:01:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 51117 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45FDA22A24 for ; Wed, 15 Jul 2015 06:02:26 +0000 (UTC) Received: by lagw2 with SMTP id w2sf7925188lag.3 for ; Tue, 14 Jul 2015 23:02:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=UE+TFG30sGNeWRwjsdb2WR6SLY7Qbf1v90V99NS0BFo=; b=nA299aoMxCsI8WHIyoYnBq6gzhSGZFMuIVWdbbby1Olv4EoE9BHCCFQUkAK5mMXZBx 6+b39HZnLE28dy8jVdk/CkNnrPzeLePY3vDY9kxe9vhLAdBHMQzJ6AspD0etyjNkykEq ppqG/WZ8Bwa4c8t71MeL/LtNyU7+eIWH0JuQKw4AfFAuvqqMF8BCtvaHfzCWNBuIRXC9 4TiYP/5tuTNUCRXBgtbi3sMN4Hutj6afqhuqlWZHJAUqCsc9PvmR70uMH5hyOICUrKA8 CmJZSzOrpv9/t5X8ljSwY+Ao4eeILxIdbeBP/TNtU/zbYwDYpYSWCUJFPDQDGsfPqdlf ZPQw== X-Gm-Message-State: ALoCoQktO6f5uGxZQ1BP2DzeoCoDA11lp53RzzKUqCBJzHXbr+XHoNmyCd6hxKortvM6KcLrd8Mm X-Received: by 10.112.171.41 with SMTP id ar9mr1278692lbc.24.1436940145247; Tue, 14 Jul 2015 23:02:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.136 with SMTP id kq8ls157952lac.32.gmail; Tue, 14 Jul 2015 23:02:24 -0700 (PDT) X-Received: by 10.112.50.66 with SMTP id a2mr2382013lbo.68.1436940144874; Tue, 14 Jul 2015 23:02:24 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id aw7si3037953lbc.80.2015.07.14.23.02.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 23:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbyj8 with SMTP id yj8so18445480lbb.0 for ; Tue, 14 Jul 2015 23:02:24 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr2334910lbc.19.1436940144783; Tue, 14 Jul 2015 23:02:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2846175lbb; Tue, 14 Jul 2015 23:02:23 -0700 (PDT) X-Received: by 10.68.76.67 with SMTP id i3mr4704698pbw.19.1436940142856; Tue, 14 Jul 2015 23:02:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm6si5691189pdb.94.2015.07.14.23.02.21; Tue, 14 Jul 2015 23:02:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbbGOGCU (ORCPT + 26 others); Wed, 15 Jul 2015 02:02:20 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:36757 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbbGOGCT (ORCPT ); Wed, 15 Jul 2015 02:02:19 -0400 Received: by pdjr16 with SMTP id r16so18881701pdj.3 for ; Tue, 14 Jul 2015 23:02:18 -0700 (PDT) X-Received: by 10.69.27.66 with SMTP id je2mr4642841pbd.72.1436940138857; Tue, 14 Jul 2015 23:02:18 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id ry2sm3228026pbb.83.2015.07.14.23.02.15 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 23:02:18 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH 4/6] time: Introduce do_sys_settimeofday64() Date: Wed, 15 Jul 2015 14:01:05 +0800 Message-Id: <98b963654e14b2199a685bb74c97f0587a231bdc.1436511577.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: baolin.wang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The do_sys_settimeofday() function uses a timespec, which is not year 2038 safe on 32bit systems. Thus this patch introduces do_sys_settimeofday64(), which allows us to transition users of do_sys_settimeofday() to using 64bit time types. Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 15 +++++++++++++-- kernel/time/time.c | 8 ++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 657ea03..dc60400 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -11,8 +11,19 @@ extern int timekeeping_suspended; */ extern void do_gettimeofday(struct timeval *tv); extern int do_settimeofday64(const struct timespec64 *ts); -extern int do_sys_settimeofday(const struct timespec *tv, - const struct timezone *tz); +extern int do_sys_settimeofday64(const struct timespec64 *tv, + const struct timezone *tz); +static inline int do_sys_settimeofday(const struct timespec *tv, + const struct timezone *tz) +{ + struct timespec64 ts64; + + if (!tv) + return -EINVAL; + + ts64 = timespec_to_timespec64(*tv); + return do_sys_settimeofday64(&ts64, tz); +} /* * Kernel time accessors diff --git a/kernel/time/time.c b/kernel/time/time.c index 85d5bb1..5d00da4 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -160,15 +160,15 @@ static inline void warp_clock(void) * various programs will get confused when the clock gets warped. */ -int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) +int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz) { static int firsttime = 1; int error = 0; - if (tv && !timespec_valid(tv)) + if (tv && !timespec64_valid(tv)) return -EINVAL; - error = security_settime(tv, tz); + error = security_settime64(tv, tz); if (error) return error; @@ -186,7 +186,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) } } if (tv) - return do_settimeofday(tv); + return do_settimeofday64(tv); return 0; }