Skip to content

Commit d0439a5

Browse files
Dan Carpentergregkh
authored andcommitted
hangcheck-timer: cleanup casting in hangcheck_init()
The 32 bit addition "(hangcheck_margin + hangcheck_tick)" could potentially overflow. It triggers a static checker warning to have an overflowed addition followed by a no-op cast. I have moved the cast so that the addition can't overflow. Also I removed the unneeded cast on the following line since both "hangcheck_tsc_margin" and "TIMER_FREQ" are already 64 bit types. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d252215 commit d0439a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/char/hangcheck-timer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ static int __init hangcheck_init(void)
168168
printk("Hangcheck: starting hangcheck timer %s (tick is %d seconds, margin is %d seconds).\n",
169169
VERSION_STR, hangcheck_tick, hangcheck_margin);
170170
hangcheck_tsc_margin =
171-
(unsigned long long)(hangcheck_margin + hangcheck_tick);
172-
hangcheck_tsc_margin *= (unsigned long long)TIMER_FREQ;
171+
(unsigned long long)hangcheck_margin + hangcheck_tick;
172+
hangcheck_tsc_margin *= TIMER_FREQ;
173173

174174
hangcheck_tsc = ktime_get_ns();
175175
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));

0 commit comments

Comments
 (0)