staging/lustre: use 64-bit computation in s2dhms()
authorArnd Bergmann <arnd@arndb.de>
Sun, 27 Sep 2015 20:45:15 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 02:03:36 +0000 (04:03 +0200)
The s2dhms computes the day/hour/minute/second values from a time_t,
which stops working in 2038. This changes the code to take a time64_t
argument, and use div_u64_rem() to implement the first division.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lprocfs_status.h

index 213666b..1b87a6a 100644 (file)
@@ -359,10 +359,12 @@ struct obd_histogram;
 struct dhms {
        int d, h, m, s;
 };
-static inline void s2dhms(struct dhms *ts, time_t secs)
+
+static inline void s2dhms(struct dhms *ts, time64_t secs64)
 {
-       ts->d = secs / 86400;
-       secs = secs % 86400;
+       unsigned int secs;
+
+       ts->d = div_u64_rem(secs64, 86400, &secs);
        ts->h = secs / 3600;
        secs = secs % 3600;
        ts->m = secs / 60;