From patchwork Fri Nov 10 16:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10053467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A3D2603FA for ; Fri, 10 Nov 2017 16:46:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4BC2B3DF for ; Fri, 10 Nov 2017 16:46:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11DC12B3E3; Fri, 10 Nov 2017 16:46:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4E342B3D5 for ; Fri, 10 Nov 2017 16:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753141AbdKJQqh (ORCPT ); Fri, 10 Nov 2017 11:46:37 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:56547 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142AbdKJQqg (ORCPT ); Fri, 10 Nov 2017 11:46:36 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0M003o-1f4tSr0tjA-00uMc9; Fri, 10 Nov 2017 17:46:29 +0100 From: Arnd Bergmann To: Hans Verkuil , Mauro Carvalho Chehab Cc: Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] vivid: print time in y2038-safe way Date: Fri, 10 Nov 2017 17:46:17 +0100 Message-Id: <20171110164628.3763522-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:9vW8fiCBefW4saZsQikTFTALHLpmsFnP6VbekfLiEkcXRqOep2w x40EbrECQ5dBI9ECXXjvU3njdk7nyu6LZdLPTgAweJDmF8YzURasvuA2sN1XHbLfZWYLi04 4ZLOov0Xs4SPVASg5xzXOQcUWH3g0y4TTkmWYKY0gl8V6EJeViZ9gjuwO5WaoUh2aVfsj6p krSaHTuK6kGOxGtEgi07w== X-UI-Out-Filterresults: notjunk:1; V01:K0:WgpDUoqP0bo=:CsHBZ5ALFf3F4Dx/MCy6ZK 6fIsFkRBtWQgpVl38YGIFkXMBJX0WDoiPl/+eOMx/OAbM1DqM/kaMiQS6uUmLx1CdGBtpi32A 6nVeoGRpSkUwKIlTzCuL3GwX+dpzpPwm4QK1NFNfhzegj55S1iCtP45v7OgLsKBJH4pLV1Yvp 1jqed0+JjBg8svx3moXcv+ciKRv4WzL1EFhUHl5Wy8AiTRsoXR75OQb2l1rDO+dwkd2eP7z9w qIdEPMfIoHgk3CJ+RYciyfW0ZCCxoabvdZKi72ruKQ1cnn53rR9MDCh/uESdsjIcvTkiypgi5 2EyBntfeL774Q0FPIKm1PSqvLfYkQ/PcyT1In1DwzZNYcURAZbP5/D+PKa1vx546KAnu1T4y6 S3+eROBYexIE0azeT2dJzX21HlAyqyp30E6ZEivOzq8v4GAfkxUPXvCN/BPstV/MeWnhYrJ3m 58X4nvhiV5O3B+rpDE8WCS0ybA7IpXldJm2quWkFwuFNPTq2WzkoCpzWISXdzK8uC6rs5NmIv vhQhl/ev6rw9BS8HKxZoFXpIf7gLLgzzWnxgFGrJTBUTaqCo3KlG1dyILeicmFAopHE/p7tUY Bbzu3+hfn4UeFQzkyEk4Wr1gKOqf5QEe9lLch8yLHewBviKIL1EtzXMoGThJlcCbagddqv9Wd DmyaTEk9BsKCQmzKJuQpBCiqjQ2fDmGna9Sku08f6acZR5SldxBD01emTzjmZn7WdHgFdECL6 mSWV+EBq6WTTd/jUf1SOur6S+YfoOWEEwRareA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP time_to_tm() takes a time_t value that overflows in 2038 on 32-bit systems. time64_to_tm() doesn't have this problem, so let's use that in combination with ktime_get_real_seconds() to read a 64-bit time value. Signed-off-by: Arnd Bergmann --- drivers/media/platform/vivid/vivid-rds-gen.c | 2 +- drivers/media/platform/vivid/vivid-vbi-gen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vivid/vivid-rds-gen.c b/drivers/media/platform/vivid/vivid-rds-gen.c index 53c7777dc001..996e35e28d37 100644 --- a/drivers/media/platform/vivid/vivid-rds-gen.c +++ b/drivers/media/platform/vivid/vivid-rds-gen.c @@ -103,7 +103,7 @@ void vivid_rds_generate(struct vivid_rds_gen *rds) * EN 50067:1998 to convert a UTC date to an RDS Modified * Julian Day. */ - time_to_tm(get_seconds(), 0, &tm); + time64_to_tm(ktime_get_real_seconds(), 0, &tm); l = tm.tm_mon <= 1; date = 14956 + tm.tm_mday + ((tm.tm_year - l) * 1461) / 4 + ((tm.tm_mon + 2 + l * 12) * 306001) / 10000; diff --git a/drivers/media/platform/vivid/vivid-vbi-gen.c b/drivers/media/platform/vivid/vivid-vbi-gen.c index a2159de83d0b..02c79d7cedab 100644 --- a/drivers/media/platform/vivid/vivid-vbi-gen.c +++ b/drivers/media/platform/vivid/vivid-vbi-gen.c @@ -190,7 +190,7 @@ static void vivid_vbi_gen_set_time_of_day(u8 *packet) struct tm tm; u8 checksum, i; - time_to_tm(get_seconds(), 0, &tm); + time64_to_tm(ktime_get_real_seconds(), 0, &tm); packet[0] = calc_parity(0x07); packet[1] = calc_parity(0x01); packet[2] = calc_parity(0x40 | tm.tm_min);