Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat Paranoia: zero COMPAT_30 ntptimeval and 32-bit nt...
details: https://anonhg.NetBSD.org/src/rev/f0baacee784f
branches: trunk
changeset: 445475:f0baacee784f
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Oct 30 14:43:38 2018 +0000
description:
Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.
These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
diffstat:
sys/compat/common/kern_time_30.c | 5 +++--
sys/compat/netbsd32/netbsd32_time.c | 7 +++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diffs (68 lines):
diff -r 61530e5bd388 -r f0baacee784f sys/compat/common/kern_time_30.c
--- a/sys/compat/common/kern_time_30.c Tue Oct 30 14:35:16 2018 +0000
+++ b/sys/compat/common/kern_time_30.c Tue Oct 30 14:43:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $ */
+/* $NetBSD: kern_time_30.c,v 1.6 2018/10/30 14:43:38 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.5 2016/11/03 03:37:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_30.c,v 1.6 2018/10/30 14:43:38 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -68,6 +68,7 @@
if (SCARG(uap, ntvp)) {
ntp_gettime(&ntv);
+ memset(&ntv30, 0, sizeof(ntv30));
TIMESPEC_TO_TIMEVAL(&tv, &ntv.time);
timeval_to_timeval50(&tv, &ntv30.time);
ntv30.maxerror = ntv.maxerror;
diff -r 61530e5bd388 -r f0baacee784f sys/compat/netbsd32/netbsd32_time.c
--- a/sys/compat/netbsd32/netbsd32_time.c Tue Oct 30 14:35:16 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_time.c Tue Oct 30 14:43:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $ */
+/* $NetBSD: netbsd32_time.c,v 1.50 2018/10/30 14:43:38 riastradh Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.50 2018/10/30 14:43:38 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -66,6 +66,7 @@
if (SCARG_P32(uap, ntvp)) {
ntp_gettime(&ntv);
+ memset(&ntv32, 0, sizeof(ntv32));
ntv32.time.tv_sec = ntv.time.tv_sec;
ntv32.time.tv_nsec = ntv.time.tv_nsec;
ntv32.maxerror = (netbsd32_long)ntv.maxerror;
@@ -96,6 +97,7 @@
if (SCARG_P32(uap, ntvp)) {
ntp_gettime(&ntv);
+ memset(&ntv32, 0, sizeof(ntv32));
ntv32.time.tv_sec = (int32_t)ntv.time.tv_sec;
ntv32.time.tv_nsec = ntv.time.tv_nsec;
ntv32.maxerror = (netbsd32_long)ntv.maxerror;
@@ -126,6 +128,7 @@
if (SCARG_P32(uap, ntvp)) {
ntp_gettime(&ntv);
+ memset(&ntv32, 0, sizeof(ntv32));
ntv32.time.tv_sec = ntv.time.tv_sec;
ntv32.time.tv_usec = ntv.time.tv_nsec / 1000;
ntv32.maxerror = (netbsd32_long)ntv.maxerror;
Home |
Main Index |
Thread Index |
Old Index