summaryrefslogtreecommitdiff
path: root/drivers/char/hangcheck-timer.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-10-29 11:42:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-07 22:24:01 +0300
commitd0439a5442cf43434d87faf34f4d2c19d3aba88a (patch)
treec55e84e8a30902fbbec6f87d7990be039ec23045 /drivers/char/hangcheck-timer.c
parentd25221525e0e2cfd70e4ec7216549c06609a8bd2 (diff)
downloadlinux-d0439a5442cf43434d87faf34f4d2c19d3aba88a.tar.xz
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>
Diffstat (limited to 'drivers/char/hangcheck-timer.c')
-rw-r--r--drivers/char/hangcheck-timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index ebc4c73d8ca4..a7c5c59675f0 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -168,8 +168,8 @@ static int __init hangcheck_init(void)
printk("Hangcheck: starting hangcheck timer %s (tick is %d seconds, margin is %d seconds).\n",
VERSION_STR, hangcheck_tick, hangcheck_margin);
hangcheck_tsc_margin =
- (unsigned long long)(hangcheck_margin + hangcheck_tick);
- hangcheck_tsc_margin *= (unsigned long long)TIMER_FREQ;
+ (unsigned long long)hangcheck_margin + hangcheck_tick;
+ hangcheck_tsc_margin *= TIMER_FREQ;
hangcheck_tsc = ktime_get_ns();
mod_timer(&hangcheck_ticktock, jiffies + (hangcheck_tick*HZ));