xref: /linux/scripts/coccinelle/misc/test_addr.cocci (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1// SPDX-License-Identifier: GPL-2.0-only
2/// The address of a variable or field is likely always to be non-zero.
3///
4// Confidence: High
5// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
6// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
7// URL: https://coccinelle.gitlabpages.inria.fr/website
8// Comments:
9// Options: --no-includes --include-headers
10
11virtual org
12virtual report
13virtual context
14
15@r@
16expression x;
17position p;
18@@
19
20*\(&x@p == NULL \| &x@p != NULL\)
21
22@script:python depends on org@
23p << r.p;
24@@
25
26cocci.print_main("test of a variable/field address",p)
27
28@script:python depends on report@
29p << r.p;
30@@
31
32msg = "ERROR: test of a variable/field address"
33coccilib.report.print_report(p[0],msg)
34