mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Fabian Frederick <fabf@skynet.be>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
	cocci@systeme.lip6.fr, Jan Kara <jack@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1 linux-next] scripts/coccinelle/misc: Warn about NULL check on kmap()
Date: Tue, 25 Apr 2017 21:33:43 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1704252133230.3576@hadrien> (raw)
In-Reply-To: <20170425181116.2499-1-fabf@skynet.be>



On Tue, 25 Apr 2017, Fabian Frederick wrote:

> This script removes NULL check on kmap() and all process involved
> (OOM message ...)
>
> Thanks to Jan Kara for explanations.
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
>  scripts/coccinelle/misc/kmap.cocci | 43 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>  create mode 100644 scripts/coccinelle/misc/kmap.cocci
>
> diff --git a/scripts/coccinelle/misc/kmap.cocci b/scripts/coccinelle/misc/kmap.cocci
> new file mode 100644
> index 0000000..9ae4a6e
> --- /dev/null
> +++ b/scripts/coccinelle/misc/kmap.cocci
> @@ -0,0 +1,43 @@
> +/// kmap never fails; remove NULL test case.
> +///
> +// Copyright: (C) 2017 Fabian Frederick.  GPLv2.
> +// Comments: -
> +// Options: --no-includes --include-headers
> +
> +virtual patch
> +virtual org
> +virtual report
> +virtual context
> +
> +@r2 depends on patch@
> +expression E;
> +position p;
> +@@
> +
> +E = kmap(...);
> +- if (!E) {
> +- ...
> +- }
> +
> +@r depends on context || report || org @
> +expression E;
> +position p;
> +@@
> +
> +* E = kmap(...);
> +* if (@p!E) {
> +* ...
> +* }
> +
> +@script:python depends on org@
> +p << r.p;
> +@@
> +
> +cocci.print_main("kmap() can't fail, NULL check and special process is not needed", p)
> +
> +@script:python depends on report@
> +p << r.p;
> +@@
> +
> +msg = "WARNING: NULL check on kmap() result is not needed."
> +coccilib.report.print_report(p[0], msg)
> --
> 2.9.3
>
>

      reply	other threads:[~2017-04-25 19:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 18:11 Fabian Frederick
2017-04-25 19:33 ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1704252133230.3576@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=fabf@skynet.be \
    --cc=jack@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®