mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Joe Perches <joe@perches.com>
Cc: Himangi Saraogi <himangi774@gmail.com>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.cz>,
	cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Coccinelle : Script to detect cast after memory allocation
Date: Sat, 14 Jun 2014 18:11:51 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1406141809050.1962@localhost6.localdomain6> (raw)
In-Reply-To: <1402761961.2756.12.camel@joe-AO725>

On Sat, 14 Jun 2014, Joe Perches wrote:

> On Sat, 2014-06-14 at 21:15 +0530, Himangi Saraogi wrote:
> > This script detects cases of use of cast for the value returned by
> > kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
> > kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
> > the cast as it is not useful. This Coccinelle script replaces
> > drop_kmalloc_cast.cocci as it removes the casting in more limited
> > cases of kmalloc, kzalloc and kcalloc.
> 
> Perhaps make this more generic for any void *?
> 
> Something like:
> 
> @@
> void *t;
> type other;
> @@
> 
> -       (other *)t
> +       t

Himangi, could you try it and check that you get at least the results that 
you get with the current rule?  Because I'm not sure that Coccinelle would 
have the type information available to know what is the return type of eg
kmalloc.  Maybe you would need to give the option --recursive-includes.

Perhaps it would be reasonable to add this among the specific functions.  
That is, t could be part of the disjunctions.

julia

  reply	other threads:[~2014-06-14 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14 15:45 Himangi Saraogi
2014-06-14 16:06 ` Joe Perches
2014-06-14 16:11   ` Julia Lawall [this message]
2014-06-14 17:01     ` Joe Perches
     [not found]       ` <CAB78YHwDpK988sKk5pzXWhuMszyyS=wtk5ETP-B-JBGdwRPxhw@mail.gmail.com>
2014-06-14 19:37         ` Julia Lawall
2014-06-14 20:03         ` Joe Perches

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.02.1406141809050.1962@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=himangi774@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=nicolas.palix@imag.fr \
    /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®