PVS-StudioWarnings

PVS-Studio warning V547 for DDKSamples

Nov 17th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. VOID HwFillRateElement(....)
  2. {
  3.   UCHAR i, j;
  4.   ....
  5.   for (i = 0; (i < basicRateSet->uRateSetLength) &&
  6.               (i < 256); i++)
  7.   {
  8.     rate[i] = 0x80 | basicRateSet->ucRateSet[i];
  9.   }
  10.   ....
  11. }
  12.  
  13. This suspicious code was found in DDKSamples project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V547 Expression 'i < 256' is always true. The value range of unsigned char type: [0, 255]. hw_mac.c 1946
  16.  
  17. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment