PVS-StudioWarnings

PVS-Studio warning V547 for NetXMS

Nov 19th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. bool CatalystDriver::isDeviceSupported(
  2.   SNMP_Transport *snmp, const TCHAR *oid)
  3. {
  4.   DWORD value = 0;
  5.   if (SnmpGet(snmp->getSnmpVersion(), snmp,
  6.              _T(".1.3.6.1.4.1.9.5.1.2.14.0"),
  7.              NULL, 0, &value, sizeof(DWORD), 0)
  8.       != SNMP_ERR_SUCCESS)
  9.     return false;
  10.   // Catalyst 3550 can return 0 as number of slots
  11.   return value >= 0;
  12. }
  13.  
  14. This suspicious code was found in NetXMS project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V547 Expression 'value >= 0' is always true. Unsigned type value is always >= 0. catalyst.cpp 71
  17.  
  18. 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