All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [Y2038] [PATCH v2 2/4] input: evdev: Replace timeval with timespec64
Date: Thu, 27 Oct 2016 13:14:44 +0200	[thread overview]
Message-ID: <4848596.2bn4Hou7Gz@wuerfel> (raw)
In-Reply-To: <20161027013433.GA14832@jelly>

On Thursday, October 27, 2016 11:34:33 AM CEST Peter Hutterer wrote:
> > @@ -257,17 +264,20 @@ static void __pass_event(struct evdev_client *client,
> >  
> >  static void evdev_pass_values(struct evdev_client *client,
> >                       const struct input_value *vals, unsigned int count,
> > -                     ktime_t *ev_time)
> > +                     struct timespec64 *ev_time)
> >  {
> >       struct evdev *evdev = client->evdev;
> >       const struct input_value *v;
> >       struct input_event event;
> > +     struct timespec64 ts;
> >       bool wakeup = false;
> >  
> >       if (client->revoked)
> >               return;
> >  
> > -     event.time = ktime_to_timeval(ev_time[client->clk_type]);
> > +     ts = ev_time[client->clk_type];
> > +     event.time.tv_sec = ts.tv_sec;
> > +     event.time.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
> 
> you have ktime_get_* helpers below but you don't have one for timespec64 to
> struct timeval? That seems like a bug waitig to happen.

This is intentional to a certain degree: we don't have a timeval64
because any conversion to a new interface should prefer timespec64
or 64-bit nanoseconds, and we try to remove timeval (along with
timespec) from everywhere in the kernel because basically all uses
are problematic for y2038.

Note that after patch 3, event->time is no longer a 'timeval'
either, so even if we had a conversion function, we could
no longer use it here.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] input: evdev: Replace timeval with timespec64
Date: Thu, 27 Oct 2016 13:14:44 +0200	[thread overview]
Message-ID: <4848596.2bn4Hou7Gz@wuerfel> (raw)
In-Reply-To: <20161027013433.GA14832@jelly>

On Thursday, October 27, 2016 11:34:33 AM CEST Peter Hutterer wrote:
> > @@ -257,17 +264,20 @@ static void __pass_event(struct evdev_client *client,
> >  
> >  static void evdev_pass_values(struct evdev_client *client,
> >                       const struct input_value *vals, unsigned int count,
> > -                     ktime_t *ev_time)
> > +                     struct timespec64 *ev_time)
> >  {
> >       struct evdev *evdev = client->evdev;
> >       const struct input_value *v;
> >       struct input_event event;
> > +     struct timespec64 ts;
> >       bool wakeup = false;
> >  
> >       if (client->revoked)
> >               return;
> >  
> > -     event.time = ktime_to_timeval(ev_time[client->clk_type]);
> > +     ts = ev_time[client->clk_type];
> > +     event.time.tv_sec = ts.tv_sec;
> > +     event.time.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
> 
> you have ktime_get_* helpers below but you don't have one for timespec64 to
> struct timeval? That seems like a bug waitig to happen.

This is intentional to a certain degree: we don't have a timeval64
because any conversion to a new interface should prefer timespec64
or 64-bit nanoseconds, and we try to remove timeval (along with
timespec) from everywhere in the kernel because basically all uses
are problematic for y2038.

Note that after patch 3, event->time is no longer a 'timeval'
either, so even if we had a conversion function, we could
no longer use it here.

	Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

  reply	other threads:[~2016-10-27 14:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  3:27 [PATCH v2 0/4] Make input drivers y2038 safe Deepa Dinamani
2016-10-18  3:27 ` [PATCH v2 1/4] uinput: Add ioctl for using monotonic/ boot times Deepa Dinamani
2016-10-27  1:45   ` Peter Hutterer
2016-10-27 20:39     ` Deepa Dinamani
2016-10-27 20:39       ` Deepa Dinamani
2016-10-28  4:32       ` Peter Hutterer
2016-10-18  3:27 ` [PATCH v2 2/4] input: evdev: Replace timeval with timespec64 Deepa Dinamani
2016-10-27  1:34   ` Peter Hutterer
2016-10-27  1:34     ` Peter Hutterer
2016-10-27 11:14     ` Arnd Bergmann [this message]
2016-10-27 11:14       ` Arnd Bergmann
2016-10-18  3:27 ` [PATCH v2 3/4] input: Deprecate real timestamps beyond year 2106 Deepa Dinamani
2016-10-27  2:24   ` Dmitry Torokhov
2016-10-27  2:24     ` Dmitry Torokhov
2016-10-27 22:25     ` Deepa Dinamani
2016-10-27 22:25       ` Deepa Dinamani
2016-10-27 23:12       ` Dmitry Torokhov
2016-10-27 23:12         ` Dmitry Torokhov
2016-10-28 12:19         ` Arnd Bergmann
2016-10-30  4:34           ` Deepa Dinamani
2016-10-27  2:56   ` Peter Hutterer
2016-10-27  2:56     ` Peter Hutterer
2016-10-27 22:24     ` Deepa Dinamani
2016-10-27 22:24       ` Deepa Dinamani
2016-10-28  4:46       ` Peter Hutterer
2016-10-28 12:44         ` Arnd Bergmann
2016-10-30  4:19         ` Deepa Dinamani
2016-10-30  4:19           ` Deepa Dinamani
2016-10-31 10:30           ` Peter Hutterer
2016-10-28 12:43   ` Arnd Bergmann
2016-10-28 15:19     ` Deepa Dinamani
2016-10-28 15:45       ` Arnd Bergmann
2016-10-28 21:39         ` Deepa Dinamani
2016-10-28 21:47           ` Arnd Bergmann
2016-10-28 21:56             ` Dmitry Torokhov
2016-10-28 22:01               ` Arnd Bergmann
2016-10-18  3:27 ` [PATCH v2 4/4] input: serio: Replace timeval by timespec64 Deepa Dinamani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4848596.2bn4Hou7Gz@wuerfel \
    --to=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.