lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 Jan 2021 10:51:14 +0800
From:   Yejune Deng <yejune.deng@...il.com>
To:     john.stultz@...aro.org, tglx@...utronix.de, sboyd@...nel.org
Cc:     linux-kernel@...r.kernel.org, yejune.deng@...il.com
Subject: [PATCH] ntp: use memset and offsetof init

In pps_fill_timex(), use memset and offsetof instead of '= 0'.

Signed-off-by: Yejune Deng <yejune.deng@...il.com>
---
 kernel/time/ntp.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 87389b9e21ab..3416c0381104 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -225,14 +225,11 @@ static inline int is_error_status(int status)
 static inline void pps_fill_timex(struct __kernel_timex *txc)
 {
 	/* PPS is not implemented, so these are zero */
-	txc->ppsfreq	   = 0;
-	txc->jitter	   = 0;
-	txc->shift	   = 0;
-	txc->stabil	   = 0;
-	txc->jitcnt	   = 0;
-	txc->calcnt	   = 0;
-	txc->errcnt	   = 0;
-	txc->stbcnt	   = 0;
+	int offset, len;
+
+	offset = offsetof(struct __kernel_timex, ppsfreq);
+	len    = offsetof(struct __kernel_timex, tai) - offset;
+	memset(txc + offset, 0, len);
 }
 
 #endif /* CONFIG_NTP_PPS */
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ