From patchwork Mon Jun 18 14:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 138958 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4008932lji; Mon, 18 Jun 2018 07:17:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL6l1rcjd3/2prBUQDFdm26/mc4cl8aCUOcBNtHz9mnEGZk/7ctQc5YP8v7Mh4cDzwDlk9E X-Received: by 2002:a17:902:8e87:: with SMTP id bg7-v6mr14281006plb.129.1529331424522; Mon, 18 Jun 2018 07:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529331424; cv=none; d=google.com; s=arc-20160816; b=NmzK5ALbAVeBYxBw0wybCGtm65A/jwLqm/3A4+KnvAOSdWi2iravI9lQnzUVSESb1Q RmA64KpFHcWc2CraMOugScZKEgT2E3/916M8VERW72vWCXOYe+CqxSKl2OvuBEJNf+8p Z6aX8LXGhIpt3qMlr1hekfV+OLXHjVZ8+L7JdbC9s7YeY/bPzps/x8UH2OlfzV7CMIVX xS0pIfSSZNCcm2OQP5p6jRlmGjQ7ChWWG8dWtLqcp2+HtFXv/3kDFiTdltdULf4K6+KB TYmY9IhpniyF8T/qGNQHqYN1taLW2A1QvkTsi9dv2pwo7eRXqhoO3aEH9TVI+tJrIVUu 4GKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RZjM4SY7buor8LgSncV7K6jbdg/ArqMFYtMZOQRIZPA=; b=jBnV3kgKwvoyx4FyXfGEUp0gJUmxBre2VqtpVfTGrUDH/PcCRK6IvKJq+SxtDFXX9e 2ClgtaQav9MQYoZ4ifNnaoP/H9XkefXoF16kzycPEW1oT9XgGnvmFf6ybe46OK6j7vQ1 vGyoMFI8kci1Ylfcc5oP/JLr/AHFrq4GwqfrzOiVUHbZaGh7MJ5Vc0lCkmin9x/MwCPj sDjQ9qscP7XeWq7A+gwlsOwKGmrKBjPb1KnHc0tja7gtNqZ/UBzFLTVsNhAg8HzsJjBM SqQhnJg5ZyGOlBZMoUsvZBWyNaTjcUY/kZQksHq59DRNnxnj4zpRwuKjp+8mbn6Ox3J1 /W6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si12159180pgo.593.2018.06.18.07.17.04; Mon, 18 Jun 2018 07:17:04 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934822AbeFRORC (ORCPT + 30 others); Mon, 18 Jun 2018 10:17:02 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:40313 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934145AbeFRORA (ORCPT ); Mon, 18 Jun 2018 10:17:00 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LrZ6L-1gDclJ05O9-013LNL; Mon, 18 Jun 2018 16:16:40 +0200 From: Arnd Bergmann To: Greg Kroah-Hartman , Jiri Slaby Cc: y2038@lists.linaro.org, Arnd Bergmann , Okash Khawaja , Al Viro , Alan Cox , Deepa Dinamani , Sahara , Tetsuo Handa , linux-kernel@vger.kernel.org Subject: [PATCH] tty: use 64-bit timstamp Date: Mon, 18 Jun 2018 16:16:26 +0200 Message-Id: <20180618141633.3303890-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:KocDYRy2ZdPfG7BCzXoSC6GfmwSZeMpsuurpdIXIYvKytCmuY4m Di8sGKdN6jFg2mOxok9z5YFIeHupJgS85jvfbblJV3FqSGuGdcQ0S7/OklGbz47OEzi0GoL k559Nt0L0/WQw/FyfQx2ArBW2v2zzNAS7Ym5BP/KJtjngNggPvNonVuEYqEwmJ3jh/CqRPC PYJdTgRj/ovsF2IfP3cig== X-UI-Out-Filterresults: notjunk:1; V01:K0:qJTfk6KjIUI=:n9C8WwlOg70+waMp6DFEcq 2CugvxVNws8OhHMuDRVKEHBUm0cNh7MaeQhTxF72wTxWduowCuWxOin6ASZhvCUTVdXH1I6gg BTEGWwGBfLSS9oS+auppk4TrOglx7z3a3Hk9awKaIP6Fh/4nwrI1ebesMrRH7FPktxbJ1S514 7goqwJCm2MZnL8ZWkZY2A3rAVz0FoheqtYMDahctFRk0XIjxbUlRSpfp535qYpko63rvUCAin BxXt/Oiw3Fe15KzDbuxcXODk2tAAZyq0kbNUrfTzn0bwBl9x6MQIh/leM5fYQNWdY51nUOauN zzximhWguJJ3H/DLoOs2Sh+jLgJ24OTl03ZulIEHYXd3beooLHbwuv9Zjzibrg5J5lOCWReDT gcmr1ozC8niAMP8BSiBRFAAp7cYom5Ys6ygwytDOzvCPYBlMNMbJWl7qR1NQ6XyidHqGuAwXO 7Iw0vV5bLXQXjizdmOSrZM+PD7LDc24YdaYVqD0V3jx1uLNpj8WvYHDblv8G6rFkkSyg77sJ3 SvXjSKCxkq8M8ZQO54lPbzDH5B6hFYD4erQ73P+YoXC3CWhMO6B4SS1ZmeHA+B5AItzxX831j M6oL3fZA95ViLSQ6o7ysVIEXgOWG0t71xLTJOE5xOfEfXQ3Ke7gMbvWmuuXUkf9MStPDt5FZU /0ZA4VPekwZi739NLdpBJSn+knVvT9jHF6QVqw49m17kXW8vhphjY7oyK8hfrkc7v2kY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The automated VFS conversion to timespec64 has left one caller of the deprecated get_seconds() function in the tty driver, this cleans it up to call ktime_get_real_seconds() instead, fixing the possible overflow. Signed-off-by: Arnd Bergmann --- drivers/tty/tty_io.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) -- 2.9.0 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index aba59521ad48..11c2df904ac9 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -814,9 +814,9 @@ void start_tty(struct tty_struct *tty) } EXPORT_SYMBOL(start_tty); -static void tty_update_time(struct timespec *time) +static void tty_update_time(struct timespec64 *time) { - unsigned long sec = get_seconds(); + time64_t sec = ktime_get_real_seconds(); /* * We only care if the two values differ in anything other than the @@ -867,13 +867,8 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count, i = -EIO; tty_ldisc_deref(ld); - if (i > 0) { - struct timespec ts; - - ts = timespec64_to_timespec(inode->i_atime); - tty_update_time(&ts); - inode->i_atime = timespec_to_timespec64(ts); - } + if (i > 0) + tty_update_time(&inode->i_atime); return i; } @@ -974,11 +969,7 @@ static inline ssize_t do_tty_write( cond_resched(); } if (written) { - struct timespec ts; - - ts = timespec64_to_timespec(file_inode(file)->i_mtime); - tty_update_time(&ts); - file_inode(file)->i_mtime = timespec_to_timespec64(ts); + tty_update_time(&file_inode(file)->i_mtime); ret = written; } out: