summaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
authorWen Yang <wenyang@linux.alibaba.com>2020-01-30 16:08:51 +0300
committerThomas Gleixner <tglx@linutronix.de>2020-03-04 12:17:51 +0300
commit38f7b0b1316d435f38ec3f2bb078897b7a1cfdea (patch)
tree6897b480ecd5caf0a03c1a39904df76fb84eea36 /kernel/time
parent4cbbc3a0eeed675449b1a4d080008927121f3da3 (diff)
downloadlinux-38f7b0b1316d435f38ec3f2bb078897b7a1cfdea.tar.xz
hrtimer: Cast explicitely to u32t in __ktime_divns()
do_div() does a 64-by-32 division at least on 32bit platforms, while the divisor 'div' is explicitly casted to unsigned long, thus 64-bit on 64-bit platforms. The code already ensures that the divisor is less than 2^32. Hence the proper cast type is u32. Signed-off-by: Wen Yang <wenyang@linux.alibaba.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20200130130851.29204-1-wenyang@linux.alibaba.com
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/hrtimer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 3a609e7344f3..d74fdcd3ced4 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -311,7 +311,7 @@ s64 __ktime_divns(const ktime_t kt, s64 div)
div >>= 1;
}
tmp >>= sft;
- do_div(tmp, (unsigned long) div);
+ do_div(tmp, (u32) div);
return dclc < 0 ? -tmp : tmp;
}
EXPORT_SYMBOL_GPL(__ktime_divns);