diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-06-18 17:25:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-07 18:44:52 +0300 |
commit | 6051e79bbfa6111c3a56a86fa8c6ff9a248e30a6 (patch) | |
tree | 39e959e6776f29de55f71d85bfc61388d9bb55a1 /drivers/misc/mic/cosm_client | |
parent | e890591413819eeb604207ad3261ba617b2ec0bb (diff) | |
download | linux-6051e79bbfa6111c3a56a86fa8c6ff9a248e30a6.tar.xz |
misc: mic: fix passing the current time
I noticed that the mic driver passes a 'struct timespec64' as part of
a message into an attached device, where it is used to set the current
system time.
This won't actually work if one of the two sides runs a 32-bit kernel and
the other runs a 64-bit kernel, since the structure layout is different
between the two.
I found this while replacing calls to the deprecated do_settimeofday64()
interface with the modern ktime_get_real_ts() variant, but it seems
appropriate to address both at the same time here.
To make sure we have a sane structure, let's define our own structure
using the layout of the 64-bit kernel.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mic/cosm_client')
-rw-r--r-- | drivers/misc/mic/cosm_client/cosm_scif_client.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/misc/mic/cosm_client/cosm_scif_client.c b/drivers/misc/mic/cosm_client/cosm_scif_client.c index beafc0da4027..225078cb51fd 100644 --- a/drivers/misc/mic/cosm_client/cosm_scif_client.c +++ b/drivers/misc/mic/cosm_client/cosm_scif_client.c @@ -63,7 +63,11 @@ static struct notifier_block cosm_reboot = { /* Set system time from timespec value received from the host */ static void cosm_set_time(struct cosm_msg *msg) { - int rc = do_settimeofday64(&msg->timespec); + struct timespec64 ts = { + .tv_sec = msg->timespec.tv_sec, + .tv_nsec = msg->timespec.tv_nsec, + }; + int rc = do_settimeofday64(&ts); if (rc) dev_err(&client_spdev->dev, "%s: %d settimeofday rc %d\n", |