From patchwork Fri Nov 10 16:45:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10053463 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 F193660365 for ; Fri, 10 Nov 2017 16:46:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E468528743 for ; Fri, 10 Nov 2017 16:46:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D95D72B3D5; Fri, 10 Nov 2017 16:46:28 +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 9435D28743 for ; Fri, 10 Nov 2017 16:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbdKJQqO (ORCPT ); Fri, 10 Nov 2017 11:46:14 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:52642 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753141AbdKJQqN (ORCPT ); Fri, 10 Nov 2017 11:46:13 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MSr7l-1ecBQ41tIr-00RsZy; Fri, 10 Nov 2017 17:46:01 +0100 From: Arnd Bergmann To: Hans Verkuil , Mauro Carvalho Chehab Cc: Arnd Bergmann , Jose Abreu , Arvind Yadav , Benjamin Gaignard , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] pulse8-cec: print time using time64_t. Date: Fri, 10 Nov 2017 17:45:54 +0100 Message-Id: <20171110164559.3737072-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:f9c5KKsVFxUYUG7ENf8N9FD+Yg85AzbRHibD7im315XqH6Fyn60 qujm+QlZ0a54yApNNCtEmuJsURgE+vdllsCgqUAYEkZIrJQLR8k3OXC0SBP8g6tiyNEeAgd MJxefwI+wq/L2/MoHyrZyeAp+LogEMtn0svqyfOtecWij/UtZQEOafYnO9MeznWs4L1Lg25 756LWBmtyR6T/wd7VfLCw== X-UI-Out-Filterresults: notjunk:1; V01:K0:EJoXSVQ1Rqo=:o0caIWD/CT9eG/3BAYtglN rWMx1zFikziYO8jV6+LyzHAkm05hsrwSsExi1Be5eRPanteIFSM/pB28tvDSDC9jV04F3AvdH hRMKrD0SSfsRGqzqQUSNtmllaonVFihVRfBHUs0kLmjb4itAqkdaTjLrGEcQnn/0C5V62WJkf gINnsJtHOYQKO4EJgy9gRj6WTz+JzDCWRC1vBT2c38gtdUV+V3RYRslCPBqB5AN2G4QggaLdg dddqHKxHbZIUrmDFCJaRkSKfeP27u8+pHZzZUeArR0T0tQYAbbxB6k8vODfpzDSEbhjh0WqhI zOD9uAeXksuJwMX1dDmQqT3h8mncJ88GWt61HX5rF2XzNU6sKwS8BpyeqIvEzY8l4jyPAzazV k1T4ZoGmmCoUQRVlqfUNx3YBxgEx9cVbsFGr9D1DBq5yyCYKxRklnmsMuMlo47Lnmi/pRRQO5 RgbiO9EU+o4CMjxWjWATOiqo/NExOdcldlkQzgM09sKB/CU6JCBBJc3oAaVcidcx0RNbauwv8 L5tU9QtYKcAEO5Lp09o4ZWvvceICB7QdtKwA6IhmtlJC651ClIO2y3J9Po7t572MkNjpjEXyM cuNFrVsb/VgEw5ZZj4YM5DT6RoUJVTy29T4AGYEYynIzgOvJ+sU16SXQE6mJ1oG7L59UjRU2v S3X3QczZxL6R9gcIb3VLr0fWZJGBAypXHWVV44JYNJoudY510yEh5USMV3yzWpXAvw1S/GDpv xeEizynG7Xas5oYhxZspoHafBbKUIi8C7TCiwA== 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 The firmware timestamp is an unsigned 32-bit value, but we copy it into a signed 32-bit variable, so we can theoretically get an overflow in the calculation when the timestamp is between 2038 and 2106. This changes the temporary variable to time64_t and changes the deprecated time_to_tm() over to time64_to_tm() accordingly. There is still an overflow in y2106, but that is a limitation of the firmware interface, not a kernel problem. Signed-off-by: Arnd Bergmann --- drivers/media/usb/pulse8-cec/pulse8-cec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c index 50146f263d90..350635826aae 100644 --- a/drivers/media/usb/pulse8-cec/pulse8-cec.c +++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c @@ -329,7 +329,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, u8 cmd[2]; int err; struct tm tm; - time_t date; + time64_t date; pulse8->vers = 0; @@ -349,7 +349,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, if (err) return err; date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; - time_to_tm(date, 0, &tm); + time64_to_tm(date, 0, &tm); dev_info(pulse8->dev, "Firmware build date %04ld.%02d.%02d %02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);