-
Notifications
You must be signed in to change notification settings - Fork 296
Description
Hi,
I work at Intel, and we have developed a tool that detects anomalous programming language expressions that can possibly lead to bugs. We scanned the code repository for this project as it has considerably high number of stars!
We found a couple of places where the code/expressions are confusing and seem to implement the logic in a rather convoluted manner. We think that the expressions could be rewritten to capture the logic accurately and precisely.
Case 1) Missing parenthesis around expression used as assignment - Line 468 in src/platform/str9/91x_fmi.c.
The code uses expression if (Protection_Level_1_Register &= FMI_Sector_Mask)
which is assigning a value to Protection_Level_1_Register
. Unless the intention was to compare Protection_Level_1_Register
with Protection_Level_1_Register & FMI_Sector_Mask
, this assignment is better protected with parenthesis. This is also a standard compiler warning with -Wall
(Details here.
Case 2) Similar case as above in src/platform/lm3s/usblib/host/usbhhidkeyboard.c#L248
Any thoughts?