PVS-StudioWarnings

PVS-Studio warning V547 for ReactOS

Nov 20th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #define IRP_MN_REMOVE_DEVICE      0x02
  2. #define IRP_MN_QUERY_ID           0x13
  3.  
  4. NTSTATUS
  5. RamdiskPnp(IN PDEVICE_OBJECT DeviceObject,
  6.            IN PIRP Irp)
  7. {
  8.   ...
  9.   // Only remove-device and query-id are allowed
  10.   if ((Minor != IRP_MN_REMOVE_DEVICE) ||
  11.       (Minor != IRP_MN_QUERY_ID))
  12.   ...
  13. }
  14.  
  15. This is what should have been written here: ((Minor == IRP_MN_REMOVE_DEVICE) || (Minor == IRP_MN_QUERY_ID))
  16.  
  17.  
  18. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression '(Minor != 0x02) || (Minor != 0x13)' is always true. Probably the '&&' operator should be used here. ramdisk ramdisk.c 1955
  21.  
  22. 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