X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/cc8bc92ae4a8e9f1a1ab61bf83d34ad8150b3405..b226f5e54a60dc81db17b1260381d7dbfea3cdf1:/bsd/kern/kern_ntptime.c diff --git a/bsd/kern/kern_ntptime.c b/bsd/kern/kern_ntptime.c index ccbfece8d..937f12d5d 100644 --- a/bsd/kern/kern_ntptime.c +++ b/bsd/kern/kern_ntptime.c @@ -267,7 +267,7 @@ ntp_gettime(struct proc *p, struct ntp_gettime_args *uap, __unused int32_t *retv NTP_UNLOCK(enable); if (IS_64BIT_PROCESS(p)) { - struct user64_ntptimeval user_ntv; + struct user64_ntptimeval user_ntv = {}; user_ntv.time.tv_sec = ntv.time.tv_sec; user_ntv.time.tv_nsec = ntv.time.tv_nsec; user_ntv.maxerror = ntv.maxerror; @@ -276,7 +276,7 @@ ntp_gettime(struct proc *p, struct ntp_gettime_args *uap, __unused int32_t *retv user_ntv.time_state = ntv.time_state; error = copyout(&user_ntv, uap->ntvp, sizeof(user_ntv)); } else { - struct user32_ntptimeval user_ntv; + struct user32_ntptimeval user_ntv = {}; user_ntv.time.tv_sec = ntv.time.tv_sec; user_ntv.time.tv_nsec = ntv.time.tv_nsec; user_ntv.maxerror = ntv.maxerror; @@ -293,11 +293,11 @@ ntp_gettime(struct proc *p, struct ntp_gettime_args *uap, __unused int32_t *retv } int -ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, __unused int32_t *retval) +ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, int32_t *retval) { - struct timex ntv; + struct timex ntv = {}; long freq; - int modes; + unsigned int modes; int error, ret = 0; clock_sec_t sec; clock_usec_t microsecs; @@ -334,7 +334,7 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, __unused int32_t *retv #if DEVELOPEMNT || DEBUG if (g_should_log_clock_adjustments) { - os_log(OS_LOG_DEFAULT, "%s:BEFORE modes %u offset %ld freq %ld status %d constant %ld time_adjtime %lld\n", + os_log(OS_LOG_DEFAULT, "%s: BEFORE modes %u offset %ld freq %ld status %d constant %ld time_adjtime %lld\n", __func__, ntv.modes, ntv.offset, ntv.freq, ntv.status, ntv.constant, time_adjtime); } #endif @@ -429,8 +429,8 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, __unused int32_t *retv #if DEVELOPEMNT || DEBUG if (g_should_log_clock_adjustments) { - os_log(OS_LOG_DEFAULT, "%s:AFTER offset %lld freq %lld status %d constant %ld time_adjtime %lld\n", - __func__, time_offset, time_freq, time_status, time_constant, time_adjtime); + os_log(OS_LOG_DEFAULT, "%s: AFTER modes %u offset %lld freq %lld status %d constant %ld time_adjtime %lld\n", + __func__, modes, time_offset, time_freq, time_status, time_constant, time_adjtime); } #endif @@ -439,8 +439,9 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, __unused int32_t *retv * returned only by ntp_gettime(); */ if (IS_64BIT_PROCESS(p)) { - struct user64_timex user_ntv; + struct user64_timex user_ntv = {}; + user_ntv.modes = modes; if (time_status & STA_NANO) user_ntv.offset = L_GINT(time_offset); else @@ -463,8 +464,9 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap, __unused int32_t *retv } else{ - struct user32_timex user_ntv; + struct user32_timex user_ntv = {}; + user_ntv.modes = modes; if (time_status & STA_NANO) user_ntv.offset = L_GINT(time_offset); else @@ -712,12 +714,12 @@ adjtime(struct proc *p, struct adjtime_args *uap, __unused int32_t *retval) if (uap->olddelta) { if (IS_64BIT_PROCESS(p)) { - struct user64_timeval user_atv; + struct user64_timeval user_atv = {}; user_atv.tv_sec = atv.tv_sec; user_atv.tv_usec = atv.tv_usec; error = copyout(&user_atv, uap->olddelta, sizeof(user_atv)); } else { - struct user32_timeval user_atv; + struct user32_timeval user_atv = {}; user_atv.tv_sec = atv.tv_sec; user_atv.tv_usec = atv.tv_usec; error = copyout(&user_atv, uap->olddelta, sizeof(user_atv));