| [chrony-dev] [RFC PATCH v1 01/17] sys_linux, sys_timex: Zero out the timex structure before use |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-dev] [RFC PATCH v1 01/17] sys_linux, sys_timex: Zero out the timex structure before use
- From: Christopher S M Hall <christopher.s.hall@xxxxxxxxx>
- Date: Sat, 6 Dec 2025 06:10:47 +0000
- Cc: christopher.s.hall@xxxxxxxxx, david.zage@xxxxxxxxx, yoong.siang.song@xxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765002152; x=1796538152; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W4yBn3ApiX+9iYMA9QcoUM7GH/6NUvOm+BdBlse7tWA=; b=USH66cBdEpR3RuzNlfBPvTziU9GjMHspU9ikGUmC3iW/KxZd9iC1PtVh Yuj88+RnXFEq3gRiGwOxR5CtHJ0lw0Y4Ul4j3NIYtnFOe6cp6O/cCyDIt 70B1kO+6S/vClpEgUN7FXjkmVykutLp1Pdy6YKyNsv5a+R4pIR2M6vqnJ P4ziTMlTTXFPrR2f1KnEi4Af8Oaw2TOzEdnkO0NnnH/AfXteFVjow/IFx UztM9UMt6s9um1CZT9pfTyVPkmXM/7nMXKb8ri87eQAs/YNllL0SDZT4u gURJYcf1nWvEIyXFJRwbyt9zjjZiCNWqxaxK+j12kD159GomnZgN0SdqO Q==;
Recent changes to Linux kernel to implement auxiliary clocks have introduced a sensitivity to non-zeroed
objects of type struct timex. When adjusting the auxiliary clocks, sporadic system call failures result.
---
sys_linux.c | 10 +++++-----
sys_timex.c | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sys_linux.c b/sys_linux.c
index c64bce4..cb7cb87 100644
--- a/sys_linux.c
+++ b/sys_linux.c
@@ -106,7 +106,7 @@ static int tick_update_hz;
static int
apply_step_offset(double offset)
{
- struct timex txc;
+ struct timex txc = {0};
txc.modes = ADJ_SETOFFSET | ADJ_NANO;
txc.time.tv_sec = -offset;
@@ -132,7 +132,7 @@ apply_step_offset(double offset)
static double
set_frequency(double freq_ppm)
{
- struct timex txc;
+ struct timex txc = {0};
long required_tick;
double required_freq;
int required_delta_tick;
@@ -158,7 +158,7 @@ set_frequency(double freq_ppm)
static double
read_frequency(void)
{
- struct timex txc;
+ struct timex txc = {0};
txc.modes = 0;
@@ -179,7 +179,7 @@ read_frequency(void)
static int
guess_hz(void)
{
- struct timex txc;
+ struct timex txc = {0};
int i, tick, tick_lo, tick_hi, ihz;
double tick_nominal;
@@ -302,7 +302,7 @@ get_version_specific_details(void)
static void
reset_adjtime_offset(void)
{
- struct timex txc;
+ struct timex txc = {0};
/* Reset adjtime() offset */
txc.modes = ADJ_OFFSET_SINGLESHOT;
diff --git a/sys_timex.c b/sys_timex.c
index 83e6d12..0f1eef2 100644
--- a/sys_timex.c
+++ b/sys_timex.c
@@ -112,7 +112,7 @@ set_frequency(double freq_ppm)
static void
set_leap(int leap, int tai_offset)
{
- struct timex txc;
+ struct timex txc = {0};
int applied, prev_status;
txc.modes = 0;
@@ -158,7 +158,7 @@ set_leap(int leap, int tai_offset)
static void
set_sync_status(int synchronised, double est_error, double max_error)
{
- struct timex txc;
+ struct timex txc = {0};
if (synchronised) {
if (est_error > MAX_SYNC_ERROR)
--
2.34.1
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.