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: 118591 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp8150924qgn; Fri, 10 Nov 2017 08:46:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMbWJFDEw2dIK321xGP68W4SkiLMx70MRRjqldclkyz7pUD7Si5rSJK91V5/yRtHJSpxhj/A X-Received: by 10.84.235.69 with SMTP id g5mr957344plt.239.1510332376911; Fri, 10 Nov 2017 08:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510332376; cv=none; d=google.com; s=arc-20160816; b=smJeMwEpL7KQTupjiiATAx6vbjAMMk9J06jFbhNgoOt5+sLwjETHoM5KpZpGfkeGi7 w5q+zDnXwtXH0t7eXQmn8dbtZfmiarwhde2fRdAiIaoWtsRHr9y11Xld6/Ank5GlfZy0 XEDMfDvznePZrimdf6ZUO5zfX6e71aJe+LgpprOMRafeko1+2FqfQF86PY4d8Kt81jxd dwhYZ+NcfrfYWz+cOKyL+agq1xkpsEYG4Y2vaSrB6Hj5TiTz6AXXSjBcDG4LkIE8XdIm o7yww5DpxfII3xEQSLcrAlC9tfBi3SCfIoF7csXC9SWqc4W3xYTp/qmaJyVHJeqv5wUu CAHA== 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=FlP1laKyjE5BpAHisMeL/h11SP0AGUOWlU2uRJjkntA=; b=n8axQlujHaODh7+PS2ZUdwKEj3bgtdQWTYoEQwc/1HqNs7UdZ5R0+Kk1MRGJiBrnyg AjlS1gtXrpmaf0XkJrqIWZqpY7zZL/mZKY+6c1xgodFoILtXqp+zEaEps3BBrw1e0fA9 qhiiQyY7JNjy5noegCpDM8c+KFX9WrsqVmuU/fTUBg4AhSUaNMynFKOL2LUig0LeHLD/ OzEPQa3Otz81CbUf+x03u/KvWAzYSxIreIx6xVbXKjs8hWBfYtzVjsmpXi+NGu/rjPqw v7gGUWjerl7xESrFQe+QgS7DJlKzaFYxzqsiYkq+PdxSDTDCliYzWkqalw8yzp7yajUN 6Afg== 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 o14si686291pli.607.2017.11.10.08.46.16; Fri, 10 Nov 2017 08:46:16 -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 S1753405AbdKJQqO (ORCPT + 24 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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);