Share via


Minimizing Noise

All verification tools have their weaknesses, and the primary weakness in PREfast for Drivers is noise. In some cases, PREfast for Drivers reports a suspected error when there is no real error in the code. This is known as a false positive result or noise.

Typically, PREfast for Drivers reports false positive results because it examines each function independently. As such, it has no information about the global state or about any work performed outside of the function. Also, like the most valuable testers, PREfast for Drivers errs on the side of caution. It reports an error whenever it cannot rule out the potential for error, even if it cannot confirm the error. Unless it finds statements that make the code explicitly safe, it behaves as if the code is unsafe.

This section describes strategies to minimize inaccurate results without suppressing warnings about real errors. This section includes:

Recognizing Noise

Coding Strategies to Minimize Noise

PREfast for Drivers Annotations

Using a Pragma Warning Directive

Coding ASSERT Macros

Filtering the Defect Log

These strategies are useful, but it is important to use them sparingly and cautiously. Always use the least suppressive strategy available, that is, the most limited strategy that quiets the noise without hiding any other potential errors in the code.

It is very tempting to suppress warnings or to judge warnings to be inaccurate, especially when PREfast for Drivers reports many warnings. However, you might be suppressing a warning about an error that can cause the driver to crash or make it vulnerable to a security risk.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011