[PATCH 1/1] time/jiffies: Fix conversion breakage on systems where USER_HZ < HZ

From: Gerd Rausch

Date: Wed Feb 25 2026 - 18:38:25 EST


Conversion from user_hz to jiffies broke with
commit 2dc164a48e6fd ("sysctl: Create converter functions with two new macros")

because the old overflow check in do_proc_dointvec_userhz_jiffies_conv()
to see if "*u_ptr" was too large got replaced by an unconditional:
+ if (USER_HZ < HZ)
+ return -EINVAL;

which will always be true on platforms with "USER_HZ < HZ".

We shouldn't need this extra check anyway, because clock_t_to_jiffies()
returns ULONG_MAX for the overflow case:
if (x >= ~0UL / (HZ / USER_HZ))
return ~0UL;

and proc_int_u2k_conv_uop() checks for "> INT_MAX" after conversion:
if (u > (ulong) INT_MAX)
return -EINVAL;

Fixes: 2dc164a48e6fd ("sysctl: Create converter functions with two new macros")
Reported-by: Colm Harrington <colm.harrington@xxxxxxxxxx>
Signed-off-by: Gerd Rausch <gerd.rausch@xxxxxxxxxx>
---
kernel/time/jiffies.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index a5c7d15fce72..9daf8c5d9687 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -256,8 +256,6 @@ EXPORT_SYMBOL(proc_dointvec_jiffies);
int proc_dointvec_userhz_jiffies(const struct ctl_table *table, int dir,
void *buffer, size_t *lenp, loff_t *ppos)
{
- if (SYSCTL_USER_TO_KERN(dir) && USER_HZ < HZ)
- return -EINVAL;
return proc_dointvec_conv(table, dir, buffer, lenp, ppos,
do_proc_int_conv_userhz_jiffies);
}
--
2.39.3