]> git.ipfire.org Git - thirdparty/openwrt.git/blob
cddd558dee7030b3220078c850b5bd2b475b5da6
[thirdparty/openwrt.git] /
1 From bb2784d9ab49587ba4fbff37a319fff2924db289 Mon Sep 17 00:00:00 2001
2 From: Easwar Hariharan <eahariha@linux.microsoft.com>
3 Date: Thu, 30 Jan 2025 19:26:58 +0000
4 Subject: [PATCH] jiffies: Cast to unsigned long in secs_to_jiffies()
5 conversion
6
7 While converting users of msecs_to_jiffies(), lkp reported that some range
8 checks would always be true because of the mismatch between the implied int
9 value of secs_to_jiffies() vs the unsigned long return value of the
10 msecs_to_jiffies() calls it was replacing.
11
12 Fix this by casting the secs_to_jiffies() input value to unsigned long.
13
14 Fixes: b35108a51cf7ba ("jiffies: Define secs_to_jiffies()")
15 Reported-by: kernel test robot <lkp@intel.com>
16 Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
17 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
18 Cc: stable@vger.kernel.org
19 Link: https://lore.kernel.org/all/20250130192701.99626-1-eahariha@linux.microsoft.com
20 Closes: https://lore.kernel.org/oe-kbuild-all/202501301334.NB6NszQR-lkp@intel.com/
21 ---
22 include/linux/jiffies.h | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25 --- a/include/linux/jiffies.h
26 +++ b/include/linux/jiffies.h
27 @@ -537,7 +537,7 @@ static __always_inline unsigned long mse
28 *
29 * Return: jiffies value
30 */
31 -#define secs_to_jiffies(_secs) ((_secs) * HZ)
32 +#define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
33
34 extern unsigned long __usecs_to_jiffies(const unsigned int u);
35 #if !(USEC_PER_SEC % HZ)