Skip to content

Commit 38f7b0b

Browse files
tasksetKAGA-KOKO
authored andcommitted
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
1 parent 4cbbc3a commit 38f7b0b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/time/hrtimer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ s64 __ktime_divns(const ktime_t kt, s64 div)
311311
div >>= 1;
312312
}
313313
tmp >>= sft;
314-
do_div(tmp, (unsigned long) div);
314+
do_div(tmp, (u32) div);
315315
return dclc < 0 ? -tmp : tmp;
316316
}
317317
EXPORT_SYMBOL_GPL(__ktime_divns);

0 commit comments

Comments
 (0)