|
@@ -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;
|