Project

General

Profile

Bug #3025

sys/dev/powermng/powernow/powernow.c:284: bad comparison ?

Added by dcb 8 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
04/11/2017
Due date:
% Done:

0%


Description

sys/dev/powermng/powernow/powernow.c:284]: (style) Checking if unsigned variable 'vco_fid-vco_cfid' is less than zero.

Source code is

while (abs(vco_fid - vco_cfid) > 2) {

but

uint32_t vco_fid, vco_cfid;

which means the expression given to abs is unsigned.
So the code only seems to do a one-sided test.

0001-Fix-powernow.c.patch View - powernow.c patch (1.13 KB) lubos, 09/23/2017 07:43 AM

History

#1 Updated by lubos 2 months ago

Attaching patch. Replace abs with diff macro.

Regards,

Lubos Boucek

Also available in: Atom PDF