diff options
author | Javi Merino <javi.merino@arm.com> | 2016-04-06 14:30:18 -0400 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2016-04-20 19:22:45 -0400 |
commit | f9d038144a171d42e057143b247ff7a12a5b06f5 (patch) | |
tree | f369a61f4a975566158427a691cc509e6d3e9cb2 /drivers/thermal | |
parent | c0ff8aaae369559fbef0e9f2606a9ae92db14f2f (diff) |
thermal: power_allocator: req_range multiplication should be a 64 bit type
req_range is declared as a u64 to cope with overflows in the
multiplication of two u32. As both req_power and power_range are u32,
we need to make sure the multiplication is done with u64 types.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/power_allocator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index 1246aa6fcab0..2f1a863a8e15 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c | |||
@@ -301,7 +301,7 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors, | |||
301 | capped_extra_power = 0; | 301 | capped_extra_power = 0; |
302 | extra_power = 0; | 302 | extra_power = 0; |
303 | for (i = 0; i < num_actors; i++) { | 303 | for (i = 0; i < num_actors; i++) { |
304 | u64 req_range = req_power[i] * power_range; | 304 | u64 req_range = (u64)req_power[i] * power_range; |
305 | 305 | ||
306 | granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range, | 306 | granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range, |
307 | total_req_power); | 307 | total_req_power); |