Merge branch 'x86/cpufeature' into irq/numa
[sfrench/cifs-2.6.git] / arch / x86 / vdso / vclock_gettime.c
index d9d35824c56f30e56266445cdf9ed5877f94bf52..6a40b78b46aafae8273ad7ed12ebbfd44187733a 100644 (file)
@@ -104,11 +104,13 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
        long ret;
        if (likely(gtod->sysctl_enabled && gtod->clock.vread)) {
-               BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
-                            offsetof(struct timespec, tv_nsec) ||
-                            sizeof(*tv) != sizeof(struct timespec));
-               do_realtime((struct timespec *)tv);
-               tv->tv_usec /= 1000;
+               if (likely(tv != NULL)) {
+                       BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
+                                    offsetof(struct timespec, tv_nsec) ||
+                                    sizeof(*tv) != sizeof(struct timespec));
+                       do_realtime((struct timespec *)tv);
+                       tv->tv_usec /= 1000;
+               }
                if (unlikely(tz != NULL)) {
                        /* Avoid memcpy. Some old compilers fail to inline it */
                        tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest;