[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1402765314.2756.20.camel@joe-AO725>
Date: Sat, 14 Jun 2014 10:01:54 -0700
From: Joe Perches <joe@...ches.com>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: Himangi Saraogi <himangi774@...il.com>,
Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <mmarek@...e.cz>, cocci@...teme.lip6.fr,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Coccinelle : Script to detect cast after memory
allocation
On Sat, 2014-06-14 at 18:11 +0200, Julia Lawall wrote:
> On Sat, 14 Jun 2014, Joe Perches wrote:
[]
> > Perhaps make this more generic for any void *?
> >
> > Something like:
> >
> > @@
> > void *t;
> > type other;
> > @@
> >
> > - (other *)t
> > + t
[]
> Perhaps it would be reasonable to add this among the specific functions.
> That is, t could be part of the disjunctions.
You do have to make sure that the
"casted to" type is not dereferenced.
ie: don't transform
void func(void *foo)
{
unsigned long bar = *(unsigned long *)foo;
}
Also there may be some __user cast types and
such that may be necessary to exclude too.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists