mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 18:50:55 +07:00
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>
This commit is contained in:
parent
c0ff8aaae3
commit
f9d038144a
@ -301,7 +301,7 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors,
|
||||
capped_extra_power = 0;
|
||||
extra_power = 0;
|
||||
for (i = 0; i < num_actors; i++) {
|
||||
u64 req_range = req_power[i] * power_range;
|
||||
u64 req_range = (u64)req_power[i] * power_range;
|
||||
|
||||
granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range,
|
||||
total_req_power);
|
||||
|
Loading…
Reference in New Issue
Block a user