fwts: cpufreq: fix theoretical division by zero

Bug #1466905 reported by Colin Ian King
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Firmware Test Suite
Fix Released
Low
Colin Ian King

Bug Description

CoverityScan reports a potential division by zero error:

528 performed_tests++;
   CID 1299399 (#1 of 2): Division or modulo by zero (DIVIDE_BY_ZERO) [select issue]
529 fwts_progress(fw, 100 * performed_tests/n_tests);

it is noteworthy that n_tests is never zero because it is related to the number of CPUs online which is always going to be > 0, but coverity does not know this and also we better ensure we check for this division by zero since the CPU online data may be not available and there is a theoretical risk of n_tests being zero.

Related branches

Revision history for this message
Colin Ian King (colin-king) wrote :
Changed in fwts:
status: New → In Progress
importance: Undecided → Low
assignee: nobody → Colin Ian King (colin-king)
Revision history for this message
Colin Ian King (colin-king) wrote :

Fix committed, commit 31faf0f5ee5b35489438f6fca159abe26b9700c6

Changed in fwts:
status: In Progress → Fix Committed
Changed in fwts:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.