From patchwork Wed Jul 29 12:16:27 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: 51659 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 300BA22DB5 for ; Wed, 29 Jul 2015 12:17:45 +0000 (UTC) Received: by wicmv11 with SMTP id mv11sf6418907wic.1 for ; Wed, 29 Jul 2015 05:17:44 -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=mgeLTg3zxQJ9G7QkJOiYM3BIx4eFIXdoecI81SFlhUROlR4UhcVyV0FK5YHmPGTj4A 2Ywc+yKVAY4IawjrMtBEmCyLK16VX1nqeLb/mW2+Pe5MLCtSKwu6ALpInZT6SVoUhu39 8M6xg108vPlCrhlSnZ0xM3DlgOf7AZVlSAiPzf+9eyb1AHC2t89rOjGrAsKe7Pgk6Psc 1OxAFkN5KHL1M88TYr8OHYShn49X0khqGBDF4JADzUbF3suQ6f86JIYtRGmazKB4B21u oxHbTcc0Otbm7u4HSsshZFDSvgOMluee4W+2lGqrc2IIMbLlleXLETl4yOZL2vjnXw/w oSOw== X-Gm-Message-State: ALoCoQlDQ78Fu07pAJncTlKzf16YkSS0b/Tuz6pcdZM2rbP6JBCHhBsTZ+7Uq4KIcK3cwdsLAwNg X-Received: by 10.180.216.12 with SMTP id om12mr3082797wic.1.1438172264522; Wed, 29 Jul 2015 05:17:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.242.131 with SMTP id wq3ls29447lac.106.gmail; Wed, 29 Jul 2015 05:17:44 -0700 (PDT) X-Received: by 10.112.147.8 with SMTP id tg8mr38446264lbb.62.1438172264196; Wed, 29 Jul 2015 05:17:44 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id dc7si21381788lad.31.2015.07.29.05.17.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 05:17:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbud7 with SMTP id ud7so1671994lbb.3 for ; Wed, 29 Jul 2015 05:17:44 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr39322892laf.32.1438172263946; Wed, 29 Jul 2015 05:17:43 -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.7.198 with SMTP id l6csp2719872lba; Wed, 29 Jul 2015 05:17:42 -0700 (PDT) X-Received: by 10.70.91.12 with SMTP id ca12mr93165833pdb.135.1438172262058; Wed, 29 Jul 2015 05:17:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rg6si46713752pdb.36.2015.07.29.05.17.40; Wed, 29 Jul 2015 05:17:42 -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 S1753209AbbG2MRj (ORCPT + 27 others); Wed, 29 Jul 2015 08:17:39 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:32846 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbbG2MRi (ORCPT ); Wed, 29 Jul 2015 08:17:38 -0400 Received: by padck2 with SMTP id ck2so5018704pad.0 for ; Wed, 29 Jul 2015 05:17:37 -0700 (PDT) X-Received: by 10.66.142.199 with SMTP id ry7mr67953867pab.14.1438172257508; Wed, 29 Jul 2015 05:17:37 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id oi17sm40513599pdb.74.2015.07.29.05.17.34 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jul 2015 05:17:36 -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 v2 4/5] time: Introduce do_sys_settimeofday64() Date: Wed, 29 Jul 2015 20:16:27 +0800 Message-Id: <71a52b361c23ab8f32e50bda927cdb07157ae582.1438170155.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.181 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; }