Skip to contentSkip to conversation

vdso/gettimeofday: Clean up read of tz_minuteswest and tz_dsttime

PATCH Applied Thomas Weißschuh 4 participants 4 messages Sep 2 – Oct 25 Generic VDSO library

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdso/gettimeofday: Clean up read of tz_minuteswest and tz_dsttime

When these fields got moved from 'struct vdso_time_data' to the new 'struct vdso_clock', this access was forgotten.

'vd' is not an array, but a pointer to a single structure. The code works by accident in its current form as CS_HRES_COARSE is 0.

Replace the incorrect array access with a regular pointer dereference.

Fixes 886653e36639 ("vdso: Rework struct vdso_time_data and introduce struct vdso_clock")
---
 lib/vdso/gettimeofday.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/vdso/gettimeofday.c +2 -2
index f7a591aba59f..6e9b03051bee 100644
@@ -374,8 +374,8 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
 		if (vdso_is_timens_clock(vc))
 			vd = vdso_timens_data(vd);
 
-		tz->tz_minuteswest = vd[CS_HRES_COARSE].tz_minuteswest;
-		tz->tz_dsttime = vd[CS_HRES_COARSE].tz_dsttime;
+		tz->tz_minuteswest = vd->tz_minuteswest;
+		tz->tz_dsttime = vd->tz_dsttime;
 	}
 
 	return 0;

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260902-vdso-tz-b999f43c24bb

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Thomas Weißschuh

When these fields got moved from 'struct vdso_time_data' to the new 'struct vdso_clock', this access was forgotten.

'vd' is not an array, but a pointer to a single structure. The code works by accident in its current form as CS_HRES_COARSE is 0.

Replace the incorrect array access with a regular pointer dereference.

Fixes 886653e36639 ("vdso: Rework struct vdso_time_data and introduce struct vdso_clock")
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Weißschuh
Quoted 10 lines · Thomas Weißschuh

When these fields got moved from 'struct vdso_time_data' to the new 'struct vdso_clock', this access was forgotten.

'vd' is not an array, but a pointer to a single structure. The code works by accident in its current form as CS_HRES_COARSE is 0.

Replace the incorrect array access with a regular pointer dereference.

Fixes 886653e36639 ("vdso: Rework struct vdso_time_data and introduce struct vdso_clock")
Quoted 28 lines
---
 lib/vdso/gettimeofday.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/vdso/gettimeofday.c +2 -3
index f7a591aba59f..6e9b03051bee 100644
@@ -374,8 +374,8 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
 		if (vdso_is_timens_clock(vc))
 			vd = vdso_timens_data(vd);
 
-		tz->tz_minuteswest = vd[CS_HRES_COARSE].tz_minuteswest;
-		tz->tz_dsttime = vd[CS_HRES_COARSE].tz_dsttime;
+		tz->tz_minuteswest = vd->tz_minuteswest;
+		tz->tz_dsttime = vd->tz_dsttime;
 	}
 
 	return 0;
 
---

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260902-vdso-tz-b999f43c24bb

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
Signature · 2 lines
Regards,
Vincenzo
#3 lore raw

[tip: timers/urgent] vdso/gettimeofday: Correct the read of tz_minuteswest and tz_dsttime

In reply to Thomas Weißschuh
The following commit has been merged into the timers/urgent branch of tip:

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     cbd0f65b48f52d308c457b0fd5201324abadb501
Gitweb:        https://git.kernel.org/tip/cbd0f65b48f52d308c457b0fd5201324abadb501
Author:        Thomas Weißschuh <[email protected]>
AuthorDate:    Wed, 02 Sep 2026 14:06:15 +02:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Sun, 25 Oct 2026 23:30:54 +01:00

vdso/gettimeofday: Correct the read of tz_minuteswest and tz_dsttime

When these fields got moved from 'struct vdso_time_data' to the new 'struct vdso_clock', this access was forgotten.

'vd' is not an array, but a pointer to a single structure. The code works by accident in its current form as CS_HRES_COARSE is 0.

Replace the incorrect array access with a regular pointer dereference.

Fixes 886653e36639 ("vdso: Rework struct vdso_time_data and introduce struct vdso_clock")
---
 lib/vdso/gettimeofday.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/vdso/gettimeofday.c +2 -2
index f7a591a..6e9b030 100644
@@ -374,8 +374,8 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *vd,
 		if (vdso_is_timens_clock(vc))
 			vd = vdso_timens_data(vd);
 
-		tz->tz_minuteswest = vd[CS_HRES_COARSE].tz_minuteswest;
-		tz->tz_dsttime = vd[CS_HRES_COARSE].tz_dsttime;
+		tz->tz_minuteswest = vd->tz_minuteswest;
+		tz->tz_dsttime = vd->tz_dsttime;
 	}
 
 	return 0;