Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp120309imm; Thu, 21 Jun 2018 15:05:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI3WWfGlIq9mw0ovA+pwwrVvQh8dWgTHQGO8BZMsH0mUGITWs20ZdFMU0aHM3kPvqtVI15E X-Received: by 2002:a63:5fc1:: with SMTP id t184-v6mr2771239pgb.183.1529618726086; Thu, 21 Jun 2018 15:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529618726; cv=none; d=google.com; s=arc-20160816; b=ThFUVatNNF/tUi5DVcZPcjWkPnCaLSYu8I/D/z3LHHvVCMuk8bGI2xAT7E4FWXXGeu lHH6MkLFJPEmRf4KVekWLmfVRl9SHZ/rSukbche5UABTM3G/b6GLsXRbVGKZi+dWiLg7 kKP2bGHwN0eCK//c+S/Wt2fzrWMFUjrR6ORdWtk+livfQVg3xbZIYzyWssT1S3nCF1+6 XRO8az886tvnK3buSMia+ZmDTewlk3UrjdDe78PGloHa1VFUa7cVd4YtkD4Jba+dZ2FP TqRyBiJ4Sj6fhl2he7jqYk5zihTxHMmKLpGcYmjF/s8Vz67m4HAzrEH4tbDiKwDmuO/L cJ5Q== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=qS+L+Pmrk7E8nM0PoXBjuMzhDF9IDdHSiGNEcjugLeM=; b=gcblRl6d2Y2AvZj9+FXrC9MRXhAMT+El9A9c3dpsDc5RsvA5Kz9Ylws0gtPrdGGTFZ B0UjSTGuweIfkRzs8ZEyMk4j1uugppQq8fT0Fu6lwNoasfO3YVs5DFiQNnH/n354zr63 NCcXB9obTpSUJBBmWr6Rd7C/BSXxVmeLA66eefkJ4joCGUQZuaU1PprNwg8GKBcEkR13 hKh/6ptaS/+2pJL5tNZe+xjTJz17ErRao0XmpDDiW289jGZXGabMWR77xbWaO6SEZ9NP kaerXS/zgd2avPYue8f3FJB3mOvlH1mRh8LpyNpKtRPkMTRy8xgKEtZQay7CTEehnHls lRJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZQQLURoc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14-v6si4803062pgq.242.2018.06.21.15.05.11; Thu, 21 Jun 2018 15:05:26 -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=@google.com header.s=20161025 header.b=ZQQLURoc; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933686AbeFUWEe (ORCPT + 99 others); Thu, 21 Jun 2018 18:04:34 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:44290 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932899AbeFUWEd (ORCPT ); Thu, 21 Jun 2018 18:04:33 -0400 Received: by mail-io0-f196.google.com with SMTP id g7-v6so4371838ioh.11 for ; Thu, 21 Jun 2018 15:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qS+L+Pmrk7E8nM0PoXBjuMzhDF9IDdHSiGNEcjugLeM=; b=ZQQLURocXq7ZcoAnzOJr4h+EomAZiWIGMGMRGvg8bqVAW00AphSZux4HByNhoO/Wtv f7irY0Yd2QZvcQ0LHnsFp6Qu1hdH6lujohI43rcd0CncPbSRS6OBHDf992DulZFe5VXE /qxa0kwfB/N4IZhGAHqjZMjQ9oj15uFAp51243NJk7Mr/3MYl+h4XcFqCNXIsIDVxfn0 pnGGmRldY/ebF5jlzSMDzjAHNmT8GJnLSPsqcZS9+cA/xqBNVH6L/RLuIM5+aZFG9k1E e2Ye7azGFaGfSwNMjxajtEWJ3/aU5NwWKSLydGPA6zgC6FH9/l+b6LSIh+uRlYgljJ42 OCzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qS+L+Pmrk7E8nM0PoXBjuMzhDF9IDdHSiGNEcjugLeM=; b=eoA/bn6RDp0AqRZ2oEnQHS3WOHjX5Tx+S01beh+4k2agLHXxmoNYv+HUXfZ2NSVXWu yrlG1KhVQAoTl+ly0G99hu6nwuPOEPRd86wqnhaNlPMHZiH5pg+RhHHYfMvOw636IcXF pE80p03vTsTOng/Vyjqz/8fCxXhphsdA75f3Uqa2q9r5Etxk476GZ0OBsww1vuSCgng8 SOQk8QlgmjmwRyAgze14J8mW8wOO2lN3JTWAiozSQY8TIp1KNi4Wu/qX746E7XZYQSA/ jJtw3hKupRs0frOOmqQVyNd8Zlh3Jx08O3iFQOjNqd7EhHc4mLs19u63HcGh89YKNgXr o8uA== X-Gm-Message-State: APt69E0UsGM65obLtMzg1mnFPazYvJuOFHnxMZwZ32/prijl5FOSN6dy 6hmt/N8/z1HyPxGUjntTJ+sucseOXotDpThRUowlFw== X-Received: by 2002:a6b:a7cc:: with SMTP id q195-v6mr21726652ioe.130.1529618672253; Thu, 21 Jun 2018 15:04:32 -0700 (PDT) MIME-Version: 1.0 References: <20180618150933.1130612-1-arnd@arndb.de> In-Reply-To: <20180618150933.1130612-1-arnd@arndb.de> From: Alistair Strachan Date: Thu, 21 Jun 2018 15:04:21 -0700 Message-ID: Subject: Re: [PATCH] staging: android/vsoc: stop using 'timespec' To: arnd@arndb.de Cc: Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , y2038@lists.linaro.org, riandrews@android.com, natechancellor@gmail.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org 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 8:09 AM 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 Tested-by: Alistair Strachan > --- > 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 >