xref: /openbmc/linux/scripts/coccinelle/misc/test_addr.cocci (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
138857318SJérémy LEFAURE// SPDX-License-Identifier: GPL-2.0-only
238857318SJérémy LEFAURE/// The address of a variable or field is likely always to be non-zero.
338857318SJérémy LEFAURE///
438857318SJérémy LEFAURE// Confidence: High
538857318SJérémy LEFAURE// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.
638857318SJérémy LEFAURE// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.
7*f01701ceSJulia Lawall// URL: https://coccinelle.gitlabpages.inria.fr/website
838857318SJérémy LEFAURE// Comments:
938857318SJérémy LEFAURE// Options: --no-includes --include-headers
1038857318SJérémy LEFAURE
1138857318SJérémy LEFAUREvirtual org
1238857318SJérémy LEFAUREvirtual report
1338857318SJérémy LEFAUREvirtual context
1438857318SJérémy LEFAURE
1538857318SJérémy LEFAURE@r@
1638857318SJérémy LEFAUREexpression x;
1738857318SJérémy LEFAUREposition p;
1838857318SJérémy LEFAURE@@
1938857318SJérémy LEFAURE
2038857318SJérémy LEFAURE*\(&x@p == NULL \| &x@p != NULL\)
2138857318SJérémy LEFAURE
2238857318SJérémy LEFAURE@script:python depends on org@
2338857318SJérémy LEFAUREp << r.p;
2438857318SJérémy LEFAURE@@
2538857318SJérémy LEFAURE
2638857318SJérémy LEFAUREcocci.print_main("test of a variable/field address",p)
2738857318SJérémy LEFAURE
2838857318SJérémy LEFAURE@script:python depends on report@
2938857318SJérémy LEFAUREp << r.p;
3038857318SJérémy LEFAURE@@
3138857318SJérémy LEFAURE
3238857318SJérémy LEFAUREmsg = "ERROR: test of a variable/field address"
3338857318SJérémy LEFAUREcoccilib.report.print_report(p[0],msg)
34