]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
time: Delete do_sys_setimeofday()
authorDeepa Dinamani <deepa.kernel@gmail.com>
Sun, 26 Mar 2017 19:04:12 +0000 (12:04 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 14 Apr 2017 19:49:54 +0000 (21:49 +0200)
struct timespec is not y2038 safe on 32 bit machines and needs to be
replaced with struct timespec64.

do_sys_timeofday() is just a wrapper function.  Replace all calls to this
function with direct calls to do_sys_timeofday64() instead and delete
do_sys_timeofday().

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: y2038@lists.linaro.org
Cc: john.stultz@linaro.org
Cc: arnd@arndb.de
Cc: linux-alpha@vger.kernel.org
Link: http://lkml.kernel.org/r/1490555058-4603-2-git-send-email-deepa.kernel@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/alpha/kernel/osf_sys.c
include/linux/timekeeping.h
kernel/compat.c
kernel/time/posix-stubs.c
kernel/time/posix-timers.c
kernel/time/time.c

index 0b961093ca5cac69fe88598ed7ebc9c023a11a78..9de47a9c6df266be583aec216d50e63061e740cd 100644 (file)
@@ -1016,6 +1016,7 @@ SYSCALL_DEFINE2(osf_gettimeofday, struct timeval32 __user *, tv,
 SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
                struct timezone __user *, tz)
 {
+       struct timespec64 kts64;
        struct timespec kts;
        struct timezone ktz;
 
@@ -1023,13 +1024,14 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
                if (get_tv32((struct timeval *)&kts, tv))
                        return -EFAULT;
                kts.tv_nsec *= 1000;
+               kts64 = timespec_to_timespec64(kts);
        }
        if (tz) {
                if (copy_from_user(&ktz, tz, sizeof(*tz)))
                        return -EFAULT;
        }
 
-       return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
+       return do_sys_settimeofday64(tv ? &kts64 : NULL, tz ? &ktz : NULL);
 }
 
 asmlinkage long sys_ni_posix_timers(void);
index b598cbc7b576847a4e3f58ebbc2c76a24f149540..3617a78897bb4a3db562815119c0b9e7be8fea9b 100644 (file)
@@ -19,21 +19,6 @@ extern void do_gettimeofday(struct timeval *tv);
 extern int do_settimeofday64(const struct timespec64 *ts);
 extern int do_sys_settimeofday64(const struct timespec64 *tv,
                                 const struct timezone *tz);
-static inline int do_sys_settimeofday(const struct timespec *tv,
-                                     const struct timezone *tz)
-{
-       struct timespec64 ts64;
-
-       if (!tv)
-               return do_sys_settimeofday64(NULL, tz);
-
-       if (!timespec_valid(tv))
-               return -EINVAL;
-
-       ts64 = timespec_to_timespec64(*tv);
-       return do_sys_settimeofday64(&ts64, tz);
-}
-
 /*
  * Kernel time accessors
  */
index 19aec5d981081d26914c14f5db2e76646c399888..1eb9e8aad8693f12b5d56e336576303a75395a93 100644 (file)
@@ -108,8 +108,8 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
 COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
                       struct timezone __user *, tz)
 {
+       struct timespec64 new_ts;
        struct timeval user_tv;
-       struct timespec new_ts;
        struct timezone new_tz;
 
        if (tv) {
@@ -123,7 +123,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
                        return -EFAULT;
        }
 
-       return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+       return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
 }
 
 static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv)
index cd6716e115e8d81a89afdc95286590ca9f7e500e..95a1b1fc396808c0aad38177e909ea8389dceb84 100644 (file)
@@ -49,13 +49,16 @@ SYS_NI(alarm);
 SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
                const struct timespec __user *, tp)
 {
+       struct timespec64 new_tp64;
        struct timespec new_tp;
 
        if (which_clock != CLOCK_REALTIME)
                return -EINVAL;
        if (copy_from_user(&new_tp, tp, sizeof (*tp)))
                return -EFAULT;
-       return do_sys_settimeofday(&new_tp, NULL);
+
+       new_tp64 = timespec_to_timespec64(new_tp);
+       return do_sys_settimeofday64(&new_tp64, NULL);
 }
 
 SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
index 50a6a47020dea9e055b7267926ee9b0e39399d3c..f215ef7927729fa2358e8c7e83aafa69665fd143 100644 (file)
@@ -214,7 +214,10 @@ static int posix_clock_realtime_get(clockid_t which_clock, struct timespec *tp)
 static int posix_clock_realtime_set(const clockid_t which_clock,
                                    const struct timespec *tp)
 {
-       return do_sys_settimeofday(tp, NULL);
+       struct timespec64 tp64;
+
+       tp64 = timespec_to_timespec64(*tp);
+       return do_sys_settimeofday64(&tp64, NULL);
 }
 
 static int posix_clock_realtime_adj(const clockid_t which_clock,
index 25bdd250457192df0a2dfc13e6c9078bb92be0d6..6574bba44b55a2917d37e683c312bf10842f88cb 100644 (file)
@@ -193,8 +193,8 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz
 SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
                struct timezone __user *, tz)
 {
+       struct timespec64 new_ts;
        struct timeval user_tv;
-       struct timespec new_ts;
        struct timezone new_tz;
 
        if (tv) {
@@ -212,7 +212,7 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
                        return -EFAULT;
        }
 
-       return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
+       return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL);
 }
 
 SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)