Skip to content

Commit

Permalink
Do not use std::move since it leads to null pointer dereference
Browse files Browse the repository at this point in the history
kTempThreshold and kTemp_2_0 still need to be used in CheckThermalServerity()
Since related data is not large, no need to use std::move here.

Test done:
VtsHalThermalTargetTest
VtsHalThermalV1_0TargetTest
VtsHalThermalV1_1TargetTest
VtsHalThermalV2_0TargetTest
CtsThermalTestCases

Tracked-On: OAM-123573
Signed-off-by: Zhiwei Li <[email protected]>
  • Loading branch information
Zhiwei-Lii authored and sysopenci committed Sep 6, 2024
1 parent 62da488 commit c60f6bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions thermal/aidl/default/Thermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ ScopedAStatus Thermal::fillTemperatures(std::vector<Temperature>* out_temperat
//CPU temperature
kTemp_2_0.type = TemperatureType::CPU;
kTemp_2_0.name = "TCPU";
ret.emplace_back(std::move(kTemp_2_0));
ret.emplace_back(kTemp_2_0);

*out_temperatures = ret;
return ScopedAStatus::ok();
Expand All @@ -317,7 +317,7 @@ ScopedAStatus Thermal::getTemperaturesWithType(TemperatureType in_type,
kTemp_2_0.type = TemperatureType::CPU;
kTemp_2_0.name = "TCPU";

out_temperatures->emplace_back(std::move(kTemp_2_0));
out_temperatures->emplace_back(kTemp_2_0);
}

return ScopedAStatus::ok();
Expand All @@ -333,7 +333,7 @@ ScopedAStatus Thermal::getTemperatureThresholds(
kTempThreshold.name = "TCPU";
kTempThreshold.hotThrottlingThresholds = {{NAN, NAN, NAN, NAN, NAN, 99, 108}};
kTempThreshold.coldThrottlingThresholds = {{NAN, NAN, NAN, NAN, NAN, NAN, NAN}};
ret.emplace_back(std::move(kTempThreshold));
ret.emplace_back(kTempThreshold);

*out_temperatureThresholds = ret;
return ScopedAStatus::ok();
Expand All @@ -351,7 +351,7 @@ ScopedAStatus Thermal::getTemperatureThresholdsWithType(
kTempThreshold.name = "TCPU";
kTempThreshold.hotThrottlingThresholds = {{NAN, NAN, NAN, NAN, NAN, 99, 108}};
kTempThreshold.coldThrottlingThresholds = {{NAN, NAN, NAN, NAN, NAN, NAN, NAN}};
out_temperatureThresholds->emplace_back(std::move(kTempThreshold));
out_temperatureThresholds->emplace_back(kTempThreshold);
}

return ScopedAStatus::ok();
Expand Down

0 comments on commit c60f6bd

Please sign in to comment.