/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    NullCheck

Domain:

    wdm

Rule ID:

    Not Applicable

Description:

     The NullCheck rule verifies that a NULL value inside the driver code is not dereferenced later in the driver.

     This rule reports a defect if either of these conditions is true:
      -There is an assignment of NULL that is dereferenced later.
      -There is a global/parameter to a procedure in a driver that may be NULL that is dereferenced later,
       and there is an explicit check in the driver that suggests that the initial value of the pointer may be NULL.

     ** Struct Example **
     This code snippet shows the proper use of a structure.

     typedef struct _B {
           int *f;
     } B;

     void GoodStruc(B *x) {
           B *y = x;
           y->f = NULL;
           if (x->f) {
                      *(x->f) = 1;
           }
     }

     This code snippet shows the improper use of a structure. The code will compile, but will produce a runtime error.

     typedef struct _A {
            int *f;
     } A;

     void BadStruc(A *x) {
           A *y = x;
           y->f = NULL;
           *(x->f) = 1;
     }

     ** Function Example **
     In this example, there is a parameter to a function that may be NULL, that is dereferenced later.
     In addition, there is an explicit check that suggests that the initial value of the pointer may be NULL.

     void Bad(int *x)
     {
           *x = 2;
           if (x != NULL)
                  *x = *x + 1;
     }

     In this example, there is no rule violation since there is likely an implicit precondition that the parameter is not expected to be NULL.

     void Good1(int *x)
     {
     *x = 2;
        *x = *x + 1;
     }
     In this second example, there is an explicit check for NULL, each time the parameter is used.

     void Good2(int *x)
     {
        if (x != NULL)
               *x = 2;
        if (x != NULL)
               *x = *x + 1;
     }


Help Link:

    https://go.microsoft.com/fwlink/?LinkId=735010

--*/

#include "slic_base.h"

sdv_main.exit
{
  abort "This is just a placeholder as the actual rule is defined by the engine";
}
