Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp594757imm; Fri, 22 Jun 2018 01:52:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKID9ts9ffGIJ9gGnmUl6XmBsMQRdV7+sLVp3Vyw0JFoe8x2RjE+SUWWsDxjBOYB286B0Aj+ X-Received: by 2002:a63:42c7:: with SMTP id p190-v6mr639211pga.142.1529657538337; Fri, 22 Jun 2018 01:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529657538; cv=none; d=google.com; s=arc-20160816; b=VmIXcaL1Gqhd6Q5bJbuXtd8r2Th/Jw4mQkCtu00T05bZ94qxBw/MXwYLPtviex0L0p 0WaQOK4e+Gj7nhpISo0nPm7UbdFRImDd+y3WGiW6ZhNIw2Shd+Vj6AU1H6XB1sqDZld/ r2/+I8Cr0dghN/SIAXRvHe06S0cirrxZvEGm+oYSG/4VI+tFFHDfuU1HMFskIPeHOFoj S9O09GO9WLGwr8uRqIJgWSOZg+K+2HN8inJvX/PLL53fH8zGRs1jvGkI1O4MEJR0yMpM Uro4yMW5NUoD7Sle/r0y/WahoQVLu4izcKrvkZcSzvrg38xa6ap7HPdEqPWsrLo12jDV 3Q4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8IKUr79Zq7Lukafthk176rIiBVVAEkc05QCl8a209js=; b=hGMaVYq+K2R3KCu1s4t7fqxJjaivxgM88DKAVU/4QCKenWLkH53I77LxWOvNU/79LQ 2phy/jhbz4Wy6QAw5QmZc51T86iXaP1j8O3BZjxd3SVUzNkXB+EN7gPQV0D8A0cEg01T 8ZmtoXNiyP3pmAbxH01erCHLuSFBZ+z8/Ur70kKYp2pVkb8waJN41AD7GprWOYOgVziV +i2QUpaV+G3HQfO4pvRb0iQJReehlkcTJFcKuedtkDVpr1jl11CGBoWjT4ETlsnndHrg O7t02I/k9/meTQ5dXSCXnp+wMkr7sbql/3mzfx7DtYZ1ykFG6lVcCUND++j5ZPYphZHU HROA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=F7j6EVq7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si5844643pgf.469.2018.06.22.01.52.03; Fri, 22 Jun 2018 01:52:18 -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; dkim=pass header.i=@android.com header.s=20161025 header.b=F7j6EVq7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932719AbeFVIvJ (ORCPT + 99 others); Fri, 22 Jun 2018 04:51:09 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:44268 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751191AbeFVIvG (ORCPT ); Fri, 22 Jun 2018 04:51:06 -0400 Received: by mail-io0-f193.google.com with SMTP id g7-v6so5457463ioh.11 for ; Fri, 22 Jun 2018 01:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8IKUr79Zq7Lukafthk176rIiBVVAEkc05QCl8a209js=; b=F7j6EVq7cIxtDElWOYB/XvZyjrMIsXcCJbpGdiVYmfPPH/U8xE5gEiYH42GGMknYD5 py3eM/53fQ+/oO79k8Rk1fcLdE0Wl8DEw0Dk++ruDJm28aXHTOZdcKXU52hG73kg9G/X 3q12XaCJ4EZ6WUMIxFe+OmDCudWNJn8YZmoZNc4t/mFQQjV4sOM4+lVmALCei6JRwXoS pclxzPYmu/HFplfawamRCdsn2uDAMpxXZCRySzQ4HgqDDpxmjGEhBJUXLc5WFMlCzZtZ zm8hKO5MUkfIWpvB5j9AFki44Wt68Z2UhcF7gKAamIlPpKwpgXoJMmTWX4OA+5LaXn8y DMvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8IKUr79Zq7Lukafthk176rIiBVVAEkc05QCl8a209js=; b=TzcMCwCISAwKtmyKQz1NIXdUMRFknqZFR/GhRVpAh/Sw7Lrphm9G2OJO6gBsswH5Gk nWjVYZ/8u1wYd+r9VvjyKSYFzUexQ6OClRUfaXh0WawkEIx8Em9U8a+eDfmVJcga8OgN 0EQ6/4LX3L+6x/+1BHOBzelT8ML8MaEBIuXuILniVHTMZILvcAYhyohE4dZEF4AO/f8h iG3iH7kF5yJ7J+y84h1WWYznxA8jQJOLtYiX56zx3PdAgVV+ROIRrYb2ncanxk6jfRvr I1pZQp7YkqrWk7JkYex/RMzKAIjj2qQWQ7fiT4U4oH6B8gKIU+IQNJ0rKjRqooVeD15G ZbuA== X-Gm-Message-State: APt69E2xqLwEjFb4RYRqnylS248UT/ju0cBO/gLaS+e10obOprL/L4eJ hIW/o/+Dr3VM/Nd1BZKgLBYQ3D2ijyWvKiJ7WBx/3Q== X-Received: by 2002:a6b:8267:: with SMTP id e100-v6mr566945iod.110.1529657466117; Fri, 22 Jun 2018 01:51:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:4642:0:0:0:0:0 with HTTP; Fri, 22 Jun 2018 01:51:05 -0700 (PDT) In-Reply-To: <20180618150933.1130612-1-arnd@arndb.de> References: <20180618150933.1130612-1-arnd@arndb.de> From: Martijn Coenen Date: Fri, 22 Jun 2018 10:51:05 +0200 Message-ID: Subject: Re: [PATCH] staging: android/vsoc: stop using 'timespec' To: Arnd Bergmann Cc: Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , y2038@lists.linaro.org, Riley Andrews , Nathan Chancellor , Alistair Strachan , "open list:ANDROID DRIVERS" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 5:09 PM, Arnd Bergmann wrote: > 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 Reviewed-by: Martijn Coenen Thanks! > --- > drivers/staging/android/vsoc.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > 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); > -- > 2.9.0 >