[U-Boot] [PATCH 1/1] scripts/coccinelle: add some more coccinelle tests

Tom Rini trini at konsulko.com
Wed Mar 7 14:28:35 UTC 2018


On Wed, Mar 07, 2018 at 02:57:19AM +0100, Heinrich Schuchardt wrote:

> kmerr: verify that malloc and calloc are followed by a check to verify
> that we are not out of memory.
> 
> badzero: Compare pointer-typed values to NULL rather than 0
> 
> Both checks are copied from the Linux kernel archive.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  scripts/coccinelle/null/badzero.cocci | 238 ++++++++++++++++++++++++++++++++++
>  scripts/coccinelle/null/kmerr.cocci   |  72 ++++++++++
>  2 files changed, 310 insertions(+)
>  create mode 100644 scripts/coccinelle/null/badzero.cocci
>  create mode 100644 scripts/coccinelle/null/kmerr.cocci
> 
> diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci
> new file mode 100644
> index 0000000000..f597c8007b
> --- /dev/null
> +++ b/scripts/coccinelle/null/badzero.cocci
> @@ -0,0 +1,238 @@
> +/// Compare pointer-typed values to NULL rather than 0
> +///
> +//# This makes an effort to choose between !x and x == NULL.  !x is used
> +//# if it has previously been used with the function used to initialize x.
> +//# This relies on type information.  More type information can be obtained
> +//# using the option -all_includes and the option -I to specify an
> +//# include path.
> +//
> +// Confidence: High
> +// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.  GPLv2.
> +// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.  GPLv2.
> +// URL: http://coccinelle.lip6.fr/
> +// Requires: 1.0.0
> +// Options:

We should probably be adding an SPDX tag here.  Or, adding one in Linux
and pulling it in then?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180307/683cc279/attachment.sig>


More information about the U-Boot mailing list