RT-Thread

Usage a logical operator “&&” instead of bitwise operator “&”

V560 CWE-571 A part of conditional expression is always true: 0xFFFF0000. peci.c 372
V560 CWE-571 A part of conditional expression is always true: 0x0000FFFF. peci.c 373

#define PECI_M0D0C_HITHR_M      0xFFFF0000  // High Threshold
#define PECI_M0D0C_LOTHR_M      0x0000FFFF  // Low Threshold

void
PECIDomainConfigGet(....)
{
  unsigned long ulTemp;
  ....
  ulTemp = HWREG(ulBase + PECI_O_M0D0C + (ulDomain * 4));
  *pulHigh =
    ((ulTemp && PECI_M0D0C_HITHR_M) >> PECI_M0D0C_HITHR_S);
  *pulLow =
    ((ulTemp && PECI_M0D0C_LOTHR_M) >> PECI_M0D0C_LOTHR_S);
}

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.