Skip to content

Commit 67c632b

Browse files
Markus BlöchlKAGA-KOKO
authored andcommitted
timekeeping: Zero initialize system_counterval when querying time from phc drivers
Most drivers only populate the fields cycles and cs_id of system_counterval in their get_time_fn() callback for get_device_system_crosststamp(), unless they explicitly provide nanosecond values. When the use_nsecs field was added to struct system_counterval, most drivers did not care. Clock sources other than CSID_GENERIC could then get converted in convert_base_to_cs() based on an uninitialized use_nsecs field, which usually results in -EINVAL during the following range check. Pass in a fully zero initialized system_counterval_t to cure that. Fixes: 6b2e299 ("timekeeping: Provide infrastructure for converting to/from a base clock") Signed-off-by: Markus Blöchl <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: John Stultz <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/all/[email protected]
1 parent 89be9a8 commit 67c632b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/timekeeping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
12561256
struct system_time_snapshot *history_begin,
12571257
struct system_device_crosststamp *xtstamp)
12581258
{
1259-
struct system_counterval_t system_counterval;
1259+
struct system_counterval_t system_counterval = {};
12601260
struct timekeeper *tk = &tk_core.timekeeper;
12611261
u64 cycles, now, interval_start;
12621262
unsigned int clock_was_set_seq = 0;

0 commit comments

Comments
 (0)