Demote argument null derefs to cross func null derefs.
[smatch.git] / validation / sm_params.c
blobfeac0e2b1d2dd030326ca5384c2d7acbe2876807
1 //#include <stdio.h>
3 struct foo {
4 int a;
5 };
7 static void func (struct foo *aa)
9 aa->a = 1;
12 void func1 (struct foo *ab)
14 if (!ab)
15 printf("Error ad is not ALLOWED to be NULL\n");
16 ab->a = 1;
19 void bar (void)
21 struct foo *ac = returns_nonnull(sizeof(*ac));
22 struct foo *ad;
24 if(1)
25 ac = 0;
26 func(ac);
27 func1(ad);
28 func(ad);
31 * check-name: Cross function dereferences
32 * check-command: smatch sm_params.c
34 * check-output-start
35 sm_params.c +16 info: unchecked param func1 0
36 sm_params.c +26 error: cross_func deref func 0
37 sm_params.c +27 error: cross_func deref func1 0
38 sm_params.c +28 error: cross_func deref func 0
39 * check-output-end