summaryrefslogtreecommitdiff
path: root/include/linux/can/dev
diff options
context:
space:
mode:
authorJoel Granados <joel.granados@kernel.org>2026-11-17 11:03:47 +0100
committerJoel Granados <joel.granados@kernel.org>2026-11-18 14:49:05 +0100
commit9fcdf40e0d7c58478d88d3e1ca69fec8badda0fd (patch)
treedae2e46fd31309d6364366a6f6bd798abd5470e4 /include/linux/can/dev
parentaebb7274476403040d582c61478df8f4a7bf9cd3 (diff)
sysctl: Do jiffy / ms conversion in ulong space
Replace jiffies_to_msecs & msecs_to_jiffies calls with sysctl specific converters. Removes the need to handle overflow corner cases when moving to and from the unsigned int and the unsigned long spaces. Handle the unsigned long overflow in the sysctl specific converters (sysctl_jiffies_to_msecs & sysctl_msecs_to_jiffies). The unsigned int overflow is handled in the generic sysctl int converters (e.g. proc_int_u2k_conv_uop). Round up on writes and down on reads for both unsigned int and unsigned long types. This is the behavior being fixed: SUL="/proc/sys/net/rxrpc/idle_conn_fast_expiry" SSI="/proc/sys/debug/test_sysctl/int_ms_jiffies" 1. Before # HZ = 300, CONFIG_TEST_SYSCTL=y & CONFIG_AF_RXRPC=y echo 1 > $SSI; cat $SSI # -> 4 echo 4 > $SSI; cat $SSI # -> 7 echo 7 > $SSI; cat $SSI # -> 10 echo 10 > $SSI; cat $SSI # -> 10 echo 4 > $SUL; cat $SUL # -> 3 echo 3 > $SUL; cat $SUL # echo: write error: Invalid argument # HZ = 100, CONFIG_TEST_SYSCTL=y & CONFIG_AF_RXRPC=y echo 2147483648 > $SUL; cat $SUL # -> 4294967276 echo 5000000000 > $SUL; cat $SUL # -> 4294967276 2. Now # HZ = 300, CONFIG_TEST_SYSCTL=y & CONFIG_AF_RXRPC=y echo 1 > $SSI; cat $SSI # -> 3 echo 3 > $SSI; cat $SSI # -> 3 echo 4 > $SSI; cat $SSI # -> 6 echo 6 > $SSI; cat $SSI # -> 6 echo 7 > $SSI; cat $SSI # -> 10 echo 10 > $SSI; cat $SSI # -> 10 echo 4 > $SUL; cat $SUL # -> 6 echo 6 > $SUL; cat $SUL # -> 6 # HZ = 100, CONFIG_TEST_SYSCTL=y & CONFIG_AF_RXRPC=y echo 2147483648 > $SUL; cat $SUL # -> 2147483650 echo 5000000000 > $SUL; cat $SUL # -> 5000000000 Fixes: afdf35cfae0d ("sysctl: Fix type truncation in sysctl_msec_to_jiffies") Fixes: b96b5c6708ea ("sysctl: Replace do_proc_do{int,ulong,uint}vec with do_proc_vec") Reported-by: Avi Weiss <thnkslprpt@gmail.com> Link: https://lore.kernel.org/all/20261102111516.1398262-2-thnkslprpt@gmail.com Signed-off-by: Joel Granados <joel.granados@kernel.org>
Diffstat (limited to 'include/linux/can/dev')
0 files changed, 0 insertions, 0 deletions