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: 118592 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8151284qgn; Fri, 10 Nov 2017 08:46:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMYCLLnX/PWqVZUeke80NnmMnb4KNf18BaA4eX02TqCu0Efbgi0t++nuEpkEZbF4WgUzvcKR X-Received: by 10.84.235.3 with SMTP id o3mr985252plk.30.1510332400098; Fri, 10 Nov 2017 08:46:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510332400; cv=none; d=google.com; s=arc-20160816; b=i+KWA5z4cC/HFOxMheNoKRP75JUvK6AmUb116aJheUYIExHU73oAX528ErYuaFglzi EkmKv3Lh3aX9XHtkO89iaW77Yd5C1mVnmYB26Gco+JmwFmNNy4p0p3j1aNxeBruCfGnj y1q4OHLkvb98o3QsIEO1RYA8xEAoJycRFx1zJwUgc1xbHd7Dft6dwdDQP2KnfA0YiBzx q3p0dP8QILwJaWkrHCgpDx82LrG+pXnYCO5ueBWO2LRNY27a2kKOZ9ssyhdWLR+H3/uB heItPtp8Z+z0YnFZkLbrqU4GX9uFVzqOEFEZSd2/8Xu/ZR4Kf4CWJatDPaTBYRzeI1sB cJ5g== 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=J2bFsTZzQL4ixOxJ8+POZ82ZIPkKxLjAjIN4RWr2618=; b=i6/iF07Ex11i+3fj6G7jGJlenvRqsIhUFpUVrn046lnOBl3WfweUfFHbUiQcOEMKf/ MNE+gyJfK6IcanCGS8WLx8sp1v26cVckMOV2HQq9a6lIEj/Oo1yt4of7ZNCSnWU4Py/h 95jVbbUa9ceOC0AQUtDYE3z5AgXhZIW47OmRSl9pLI/VzU5HxRjRT9LMhcYZsC81uR9G 70ym5clTTSp6/pRwMZ+x6EB1lSv9NkADDLphItGcgXA8WIONG06X0/6eU7twJ49cHEUo eyENeuPaEcHZB/FezH3vik4mC2kz0k7UOD5052BRLvggbUg/B1nQWMaScMY86yY/nLei XBRw== 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 j16si9129896pga.622.2017.11.10.08.46.39; Fri, 10 Nov 2017 08:46:40 -0800 (PST) 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 S1753479AbdKJQqi (ORCPT + 24 others); Fri, 10 Nov 2017 11:46:38 -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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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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);