diff options
Diffstat (limited to 'arch/x86/vdso')
-rw-r--r-- | arch/x86/vdso/vclock_gettime.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index d9d35824c56..6a40b78b46a 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c | |||
@@ -104,11 +104,13 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) | |||
104 | { | 104 | { |
105 | long ret; | 105 | long ret; |
106 | if (likely(gtod->sysctl_enabled && gtod->clock.vread)) { | 106 | if (likely(gtod->sysctl_enabled && gtod->clock.vread)) { |
107 | BUILD_BUG_ON(offsetof(struct timeval, tv_usec) != | 107 | if (likely(tv != NULL)) { |
108 | offsetof(struct timespec, tv_nsec) || | 108 | BUILD_BUG_ON(offsetof(struct timeval, tv_usec) != |
109 | sizeof(*tv) != sizeof(struct timespec)); | 109 | offsetof(struct timespec, tv_nsec) || |
110 | do_realtime((struct timespec *)tv); | 110 | sizeof(*tv) != sizeof(struct timespec)); |
111 | tv->tv_usec /= 1000; | 111 | do_realtime((struct timespec *)tv); |
112 | tv->tv_usec /= 1000; | ||
113 | } | ||
112 | if (unlikely(tz != NULL)) { | 114 | if (unlikely(tz != NULL)) { |
113 | /* Avoid memcpy. Some old compilers fail to inline it */ | 115 | /* Avoid memcpy. Some old compilers fail to inline it */ |
114 | tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest; | 116 | tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest; |