Skip to content

Commit bb2784d

Browse files
easwarhKAGA-KOKO
authored andcommitted
jiffies: Cast to unsigned long in secs_to_jiffies() conversion
While converting users of msecs_to_jiffies(), lkp reported that some range checks would always be true because of the mismatch between the implied int value of secs_to_jiffies() vs the unsigned long return value of the msecs_to_jiffies() calls it was replacing. Fix this by casting the secs_to_jiffies() input value to unsigned long. Fixes: b35108a ("jiffies: Define secs_to_jiffies()") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20250130192701.99626-1-eahariha@linux.microsoft.com Closes: https://lore.kernel.org/oe-kbuild-all/202501301334.NB6NszQR-lkp@intel.com/
1 parent 1f56684 commit bb2784d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/jiffies.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static __always_inline unsigned long msecs_to_jiffies(const unsigned int m)
537537
*
538538
* Return: jiffies value
539539
*/
540-
#define secs_to_jiffies(_secs) ((_secs) * HZ)
540+
#define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
541541

542542
extern unsigned long __usecs_to_jiffies(const unsigned int u);
543543
#if !(USEC_PER_SEC % HZ)

0 commit comments

Comments
 (0)