From patchwork Mon Jun 18 15:09:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 138988 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4066654lji; Mon, 18 Jun 2018 08:09:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKgloFUrb/ypKActgQUQ41vtR8l/pSTNoIDr0ifYor/6sdf05zy3J31f4WUTiFDw0gmlgZj X-Received: by 2002:a62:f551:: with SMTP id n78-v6mr14120754pfh.200.1529334591014; Mon, 18 Jun 2018 08:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529334591; cv=none; d=google.com; s=arc-20160816; b=TRgDLMB5ugfX1sCF3tLrc/WFquO3YOgkZFxM/G3DkHf8x3gbgyrDvJNZw/KtSuA4OV x9r9oinkpKAvJDs9L2xUYCYyOhtJriO9XE7nwZCJHqQaakgRgwGCBtIv74c3JI6i97lR zr4qaBv1/BJ/VyhBmwB3MgLc+7YdeowIwKZDvQzXk8rJfAjkvaDJYdSCOZOkDFPO9nPr wI2q233hV4EK83oHTuuXUzOQliuRlM+0d9cMnBpeO+2oDh3+NHSzgZAC4HhCvT8q36Ec SNIISzj4IINIZszZJZzp7ebz+8qWfUouo1+4Lgg1Nmh9tt4fvon1+8DPI+DjHtHESvRm CiVQ== 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=bSCADI/o8pXaiWMK0RfAvTgPGlFuZIfhfvdk2+vaBDA=; b=hpsA8MnUjqtGHurIXNp2T1ucnHzFAVuxKD0oLKzW+SIP+zm5YjynF/Q3d83XKeUnX1 5nX1XWcl5mQzAuWHO+E5C5ljeekZIIFPn2sp2a2COR6xqFQiEKoBKJOe6RJ1arBJIWgy t8pfhhY7e28twO3xm23ozcj4XKsef7akRvQBIMcckHhrEjrcEUk+sPV1HmQK7G/kRfap FiUaGY95IovA9fLfdHPK8j1Md8fnEy9ECXDd2QYManja/CcwhJWKAlLwdlem4iae6ddI WxCPUDDCwZtM66R8CgaGtxYosUGFuZ/YU+BMUFb/9hS36eR5ZplA41vuivJWcUARqJsE 4sAQ== 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 y7-v6si14711632plt.115.2018.06.18.08.09.50; Mon, 18 Jun 2018 08:09:51 -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 S935827AbeFRPJt (ORCPT + 30 others); Mon, 18 Jun 2018 11:09:49 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:37515 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935783AbeFRPJp (ORCPT ); Mon, 18 Jun 2018 11:09:45 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0MDr1W-1fR7t63QvW-00H8FZ; Mon, 18 Jun 2018 17:09:38 +0200 From: Arnd Bergmann To: Greg Kroah-Hartman , =?utf-8?q?Arve_Hj?= =?utf-8?b?w7hubmV2w6Vn?= , Todd Kjos , Martijn Coenen Cc: y2038@lists.linaro.org, Riley Andrews , Arnd Bergmann , Nathan Chancellor , Alistair Strachan , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: android/vsoc: stop using 'timespec' Date: Mon, 18 Jun 2018 17:09:09 +0200 Message-Id: <20180618150933.1130612-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:epIpnDGNxThKxTKXqv+3YABcHqa2ID3BYxNR4H1TqAQBWT3HyHf ksfuZfrRMT4tn6rzVBThFkIrz1SgBudxm9ijg981BBC/mzxF1yeHyJ3mX5v2r1ilxG2Kdfb stJg38fGIre5CGF7eBon2YR1FarlKQEdsSCYX7Ovwcdq376IWbqfZzUCGxJobG+FTkS0coA H8DM9hZggTJ8frLKN/IEw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Dd36o3RPJ0E=:OFY6/mpqescaHELkLLM3GL 4jjQ/eToHpCJ/2UWzCXuvPNiqBsRTeEoj5u6Yv0rx5OrI8gj3bAW97JZPwONJiyEJk36o17DV A3SV7GfGhKJ9PDUHPyHweXypx4vmpOBzp5p42JmJyuRiE6p+LBPtGxuTnmJAVE2+7LsFeNPED AQ6sFVwBvN4Svnbu31HUSvzvJO79k1sXtEslwuOtHOQ/poH0O0RJzcVGSC7WTSiXnyGu5cBFs vqd2MIDTsOnNVrN4D5vOIm5XTHJfQYGg+X3HWHYtFkVwv07/tobqlRzLfbGdDc/gNKBn014r3 w/GKWbffc0mFHm3YRqw0cOOLPpP4qBn3Q58yrv+wPb97QxmIEt/N5bM1dlo9fJ3XYDX6zIr4o kLk3Vl4YCdmzAAEYAmg8wh7Br7k1mR9uMVLPd+12gfXbRG4N+4KQpMnN5TcLskwo6CQ04TGcF 2bdt1vnd9wnxC5G5MPrJ7v4BlXTR0vSqhvyr/rqcbwk1++JDx7BdbODxk55t/2atwf+fT9ZA+ wdAD7FWODbt+5jDrB86JQqvWo2MIYGkBUEHhCE058/nbjh+BwfebQCXjltRpHAfCbGqWNmraP 2xbnTVMWTx0hWnGOl2k2zMDaQ1lInB0r4V9DW6hMJKsI3fjNbJC1I8T6tUnsi6bBjtHHao7t8 FlJrHq4RTqHjiF6mGOj17Bv/i+BBWWRaDmLLvYblduf55dAvdcCbQQsp6uVIM8ztXt2Y= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The timespec structure suffers from the y2038 overflow and should not be used. This changes handle_vsoc_cond_wait() to use ktime_t directly. Signed-off-by: Arnd Bergmann --- drivers/staging/android/vsoc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.9.0 Tested-by: Alistair Strachan Reviewed-by: Martijn Coenen diff --git a/drivers/staging/android/vsoc.c b/drivers/staging/android/vsoc.c index 806beda1040b..22571abcaa4e 100644 --- a/drivers/staging/android/vsoc.c +++ b/drivers/staging/android/vsoc.c @@ -405,7 +405,7 @@ static int handle_vsoc_cond_wait(struct file *filp, struct vsoc_cond_wait *arg) int ret = 0; struct vsoc_device_region *region_p = vsoc_region_from_filep(filp); atomic_t *address = NULL; - struct timespec ts; + ktime_t wake_time; /* Ensure that the offset is aligned */ if (arg->offset & (sizeof(uint32_t) - 1)) @@ -433,14 +433,13 @@ static int handle_vsoc_cond_wait(struct file *filp, struct vsoc_cond_wait *arg) * We do things this way to flatten differences between 32 bit * and 64 bit timespecs. */ - ts.tv_sec = arg->wake_time_sec; - ts.tv_nsec = arg->wake_time_nsec; - - if (!timespec_valid(&ts)) + if (arg->wake_time_nsec >= NSEC_PER_SEC) return -EINVAL; + wake_time = ktime_set(arg->wake_time_sec, arg->wake_time_nsec); + hrtimer_init_on_stack(&to->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - hrtimer_set_expires_range_ns(&to->timer, timespec_to_ktime(ts), + hrtimer_set_expires_range_ns(&to->timer, wake_time, current->timer_slack_ns); hrtimer_init_sleeper(to, current);