Share via


Recognizing Noise

PREfast for Drivers is designed to report any error that it detects, but to avoid reports of errors that are unlikely to be accurate. However, some false-positive reports (noise) are unavoidable. The best strategy is to understand these cases and recognize them in your code.

In particular, the following valid conditions can cause false-positive results in PREfast for Drivers:

  • Members of structures and other objects that are not simple variables can fail sensitive tests for flow of control.

  • Wrapper functions can cause false positive results for many kinds of warnings, such as memory leaks, resource leaks, NULL pointer dereferencing, uninitialized memory access, and incorrect argument types. Most of these false positives can be addressed with proper annotations, with the added benefit of making sure the annotated function is used correctly.

  • Functions intended for a particular purpose, such as callback functions, are subject to special rules. If PREfast for Drivers identifies the function incorrectly, it might produce a number of false positive results. You can identify this problem by the appearance of Warning 28101, which is an informational message. Most of these false positives can be addressed with proper annotations, with the added benefit of making sure the annotated function is used correctly.

PREfast for Drivers also can fail to report some instances of potential coding errors.

  • PREfast for Drivers might not recognize the first instance in which a potentially NULL pointer is dereferenced if the pointer is a global variable or a function parameter. PREfast for Drivers does not monitor pointers for potential NULL values until the code indicates that they might be NULL, such as by using an assertion or testing for a NULL value. To make sure that PREfast for Drivers recognizes and monitors every possible dereference and reports Warning 6011, use an annotation, such as __in, __in_opt, or __out. For more information about the annotations, see Header Annotations in the Microsoft Windows SDK documentation. For information about driver-specific annotation, see PREfast for Drivers Annotations.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011