[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150204131633.GA23913@opentech.at>
Date: Wed, 4 Feb 2015 14:16:33 +0100
From: Nicholas Mc Guire <der.herr@...r.at>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Nicholas Mc Guire <hofrat@...dl.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Abel Moyo <abelmoyo.ab@...il.com>,
Larry Finger <Larry.Finger@...inger.net>
Subject: Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases
On Wed, 04 Feb 2015, Dan Carpenter wrote:
> Btw, what tool are you using to find these?
>
working on a set of coccinell scripts - they are not yet
really clean - but this one is simply:
virtual context
virtual patch
virtual org
virtual report
@assign@
position p;
statement S1;
@@
<+...
* if@p (...) S1 else S1
...+>
@script:python@
p << assign.p;
@@
print "%s:%s WARNING: condition with no effect" % (p[0].file,p[0].line)
I guess this is not wildly impressive - but it seems to be effective
in finding a lot of broken code. The rate of false postivs has been
supprisingly low (very few case of intentional if==else like in
./fs/kernfs/file.c:661 - which is nicely documented)
thx!
hofrat
--
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