Skip to content

Commit

Permalink
thermal_monitor: fix negative loop bounds issue
Browse files Browse the repository at this point in the history
unsigned integers trip and trip_count should be signed since
thermaldInterface.getTripCountForZone(zone) can return a -ve.
Fixes CoverityScan CID 150269:

"CID 150269 (intel#1 of 1): Negative loop bound (NEGATIVE_RETURNS)
 negative_returns: Using unsigned variable trip_count in a
 loop exit condition."

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
Colin Ian King committed Jul 11, 2016
1 parent baaee2d commit 244b173
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/thermal_monitor/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ void MainWindow::displayTemperature(QCustomPlot *customPlot)

// Draw a dashed horz line for each min valid trip temperature
QVector<QCPItemLine *> these_trips;
uint trip_count = thermaldInterface.getTripCountForZone(zone);
int trip_count = thermaldInterface.getTripCountForZone(zone);
if (trip_count > 0) {
for (uint trip = 0; trip < trip_count; trip++){
for (int trip = 0; trip < trip_count; trip++){
QCPItemLine *line = new QCPItemLine(customPlot);
customPlot->addItem(line);
temp = thermaldInterface.getTripTempForZone(zone, trip);
Expand Down

0 comments on commit 244b173

Please sign in to comment.