PVS-StudioWarnings

PVS-Studio warning V547 for libusb

Nov 12th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. int linux_get_device_address (....,
  2.   uint8_t *busnum, uint8_t *devaddr,
  3.   ....)
  4. {
  5.   ....
  6.   *busnum = __read_sysfs_attr(ctx, sys_name, "busnum");
  7.   if (0 > *busnum)
  8.     return *busnum;
  9.  
  10.   *devaddr = __read_sysfs_attr(ctx, sys_name, "devnum");
  11.   if (0 > *devaddr)
  12.     return *devaddr;
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in libusb project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V547 Expression '0 > * busnum' is always false. Unsigned type value is never < 0. linux_usbfs.c 620
  19.  
  20. 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