On Sat, 2012-12-08 at 15:34 -0200, Peter Senna Tschudin wrote:
This semantic patch looks for semicolons that can be removed without
changing the semantics of the code. The confidence is moderate
because there are some false positives on cases like:
b/drivers/mmc/host/cb710-mmc.c:589
Any ideas on how to trace call graphs to determine when
struct pointer arguments can be converted from non const
to const?
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
On Tue, 2014-04-01 at 20:29 +0200, Peter Senna Tschudin wrote:
I changed the first rule to:
@@
identifier func;
expression S,E;
@@
void func(...) {
...
- if (E) return S;
+ if (E) {S; return;}
Thanks Peter, that makes more sense than
what I wrote.
cheers, Joe
On Wed, 2014-04-02 at 07:53 +0200, Julia Lawall wrote:
On Tue, 1 Apr 2014, Joe Perches wrote:
On Tue, 2014-04-01 at 20:29 +0200, Peter Senna Tschudin wrote:
I changed the first rule to:
@@
identifier func;
expression S,E;
@@
void func(...) {
...
- if (E) return S
On Thu, 2014-06-19 at 18:49 +0200, Julia Lawall wrote:
On Thu, 19 Jun 2014, Joe Perches wrote:
On Thu, 2014-06-19 at 21:59 +0530, Himangi Saraogi wrote:
This script detects the use of a parenthesis around return value ot the
return statements and removes them as they are unnecessary
On Thu, 2014-06-19 at 21:59 +0530, Himangi Saraogi wrote:
This script detects the use of a parenthesis around return value ot the
return statements and removes them as they are unnecessary and against
the CodingStyle. A new directory called checkpatch is added for semantic
patches that just
Hi.
I tried this:
$ spatch --version
spatch version 1.0.0-rc21 without Python support and with PCRE support
$ cat char_index.cocci
@@
unsigned char * foo;
expression e;
@@
- *(foo + e)
+ foo[e]
@@
char * foo;
expression e;
@@
- *(foo + e)
+ foo[e]
$
with
$ spatch
On Sun, 2014-08-17 at 05:11 -0500, Julia Lawall wrote:
On Sat, 16 Aug 2014, Joe Perches wrote:
On Sat, 2014-08-16 at 13:06 -0700, Joe Perches wrote:
The suggested conversion to sk-data + frame_size / 2[10]
is not correct.
Actually, th[at's rc14's uncompilable output.
I started
I added a checkpatch entry for this.
Maybe some cocci test like this would be useful?
@@
type t;
t *p;
@@
- p == NULL
+ !p
@@
type t;
t *p;
@@
- p != NULL
+ p
@@
type t;
t *p;
@@
- NULL == p
+ !p
@@
type t;
t *p;
@@
- NULL != p
+ p
On Wed, 2014-12-03 at 19:02 +0100, Julia Lawall wrote:
On Wed, 3 Dec 2014, Joe Perches wrote:
Most all printks uses do not have any side-effects.
Some however modify local or global state or perform
IO on various ports.
Things like:
drivers/video/fbdev/sa1100fb.c: dev_dbg
Most all printks uses do not have any side-effects.
Some however modify local or global state or perform
IO on various ports.
Things like:
drivers/video/fbdev/sa1100fb.c: dev_dbg(fbi-dev, DBAR1: 0x%08x\n,
readl_relaxed(fbi-base + DBAR1));
drivers/remoteproc/remoteproc_core.c: dev_err(dev,
On Fri, 2014-12-05 at 08:18 +0100, Julia Lawall wrote:
On Thu, 4 Dec 2014, Joe Perches wrote:
Is it possible for coccinelle to look at the name
of a function that might be embedded in a format?
ie for:
void testme(void)
{
printf(testme: some message\n);
}
Can it find
On Fri, 2014-12-05 at 07:24 -0800, Joe Perches wrote:
My preference would be to eventually eliminate printk
altogether but I don't see a real problem adding
#define printf printk
to include/linux/printk.h
but
(bah, bad touchpad)
but I'm not going to write or ack that patch
On Fri, 2014-12-05 at 16:14 +0100, Rasmus Villemoes wrote:
Hardcoding the function name in a literal string also makes typos (or
copy-pastos) possible. I extended Julia's code to allow a small edit
distance. Requires the Levenshtein python module (on debian, apt-get
install
On Fri, 2015-09-04 at 17:55 +0200, Julia Lawall wrote:
> Move constants to the right in binary operators.
Thanks Julia.
I think this should be sent to lkml.
Does this manage to not move upper case identifiers
that aren't constants?
{
int E = foo();
if (E < bar())
On Thu, 2016-06-23 at 13:53 -0500, Andrew F. Davis wrote:
> Add a script to check for unneeded conversions to bool.
this could also be extended for bool functions that:
return !!expression;
and
return expression != 0;
___
Cocci mailing
On Tue, 2016-02-09 at 13:55 +0100, SF Markus Elfring wrote:
> > > Would you like to consider also the reuse of SmPL variables
> > > like "org" and "report"?
> >
> > I think that there is no point for these things, because checkpatch
> > already gives warnings about this issue.
>
> Can the check
On Mon, 2016-03-14 at 21:43 +0100, Julia Lawall wrote:
> On Mon, 14 Mar 2016, Joe Perches wrote:
> > I wrote a little cocci script to remove unnecessary
> > casts for memset and memcpy (below) and tested it on
> > linux kernel's drivers/staging/ directory.
> >
> &g
I wrote a little cocci script to remove unnecessary
casts for memset and memcpy (below) and tested it on
linux kernel's drivers/staging/ directory.
For instance, when dst and src are already pointers:
- memcpy((u8 *)dst, (u8 *)src, r8712_get_wlan_bssid_ex_sz(src));
+ memcpy(dst, src,
There's ~150 of these in the kernel.
Maybe there's use for this conversion to be added
to scripts/coccinelle/misc/boolreturn.cocci or in
a separate file.
$ cat booltruefalse.cocci
@@
identifier fn;
expression e;
typedef bool;
symbol true;
symbol false;
@@
bool fn ( ... )
{
<...
- if (e)
Hi Julia.
Could coccinelle identify non-const arrays that are never modified
by anything and add const like this patch below by some mechanism?
---
On Thu, 2016-09-08 at 19:49 -0700, Joe Perches wrote:
> Moving data to text is a good thing.
>
>
> Mark the regulator_info stru
On Tue, 2017-04-11 at 16:09 +0200, Greg Kroah-Hartman wrote:
> Care to use "real" kernel variable types please? u8, u16, and others
> are you friend, uint8_t really isn't what we prefer, and checkpatch
> should tell you that...
checkpatch doesn't warn about "u?int\d+_t" types unless
--strict is
On Tue, 2017-04-11 at 20:42 +0200, Greg Kroah-Hartman wrote:
> On Tue, Apr 11, 2017 at 11:15:54AM -0700, Joe Perches wrote:
> > On Tue, 2017-04-11 at 16:09 +0200, Greg Kroah-Hartman wrote:
> > > Care to use "real" kernel variable types please? u8, u16, and others
&
This seems a generic type of defect
that cocci could handle well.
I should have cc'd you on the original.--- Begin Message ---
On Fri, 2017-06-16 at 19:45 +0200, Frans Klaver wrote:
> The header field in struct pd_message is declared as an __le16 type. The
> data in the message is supposed to be
On Wed, 2017-08-30 at 23:41 +0200, Julia Lawall wrote:
> New version.
Thanks.
fyi: This doesn't find const structs that could be static.
Things like: drivers/gpu/drm/i915/selftests/i915_vma.c
[]
static int igt_vma_rotate(void *arg)
{
[]
const struct intel_rotation_plane_info planes[] =
A simple cocci script that removes unnecessary casts of
a void * will also remove casts with __force or __user
e.g.:
- xemaclite_aligned_write(address_ptr, (u32 __force *) addr, ETH_ALEN);
+ xemaclite_aligned_write(address_ptr, addr, ETH_ALEN);
Is there a simple mechanism to avoid
On Wed, 2017-08-30 at 13:41 +0200, Julia Lawall wrote:
> The following seems to work:
>
> @initialize:ocaml@
> @@
>
> let diff(p,i) = not ((List.hd p).current_element = i)
>
> @promising disable optional_storage@
> position p;
> constant c;
> type t;
> identifier i;
> @@
>
> const t i@p[] = {
On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote:
> On Wed, 30 Aug 2017, Joe Perches wrote:
> > fyi: This doesn't find const structs that could be static.
> >
> > Things like: drivers/gpu/drm/i915/selftests/i915_vma.c
> > []
> > static int igt_vma_rotate(void
On Thu, 2017-08-31 at 21:25 +0200, Julia Lawall wrote:
> On Thu, 31 Aug 2017, Joe Perches wrote:
> > On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote:
> > > On Wed, 30 Aug 2017, Joe Perches wrote:
> > > > fyi: This doesn't find const structs that could be static
On Thu, 2017-10-05 at 21:40 +0200, Julia Lawall wrote:
> On Thu, 5 Oct 2017, Joe Perches wrote:
> > btw: spatch 1.7 doesn't seem to have a tag in git
> >
> > From the script:
> >
> > // Requires: 1.0.7
> >
> > Assuming this is correct, then
On Thu, 2017-10-05 at 12:46 -0700, Liam Breck wrote:
> Hi Joe,
>
> On Thu, Oct 5, 2017 at 12:30 PM, Joe Perches <j...@perches.com> wrote:
> > On Thu, 2017-10-05 at 21:19 +0200, Julia Lawall wrote:
> > > On Thu, 5 Oct 2017, Joe Perches wrote:
> > > > On Th
On Thu, 2017-10-05 at 21:19 +0200, Julia Lawall wrote:
> On Thu, 5 Oct 2017, Joe Perches wrote:
> > On Thu, 2017-10-05 at 21:13 +0200, Julia Lawall wrote:
> > > On Fri, 6 Oct 2017, Masahiro Yamada wrote:
> > > > 2017-10-01 21:42 GMT+09:00 Juli
On Thu, 2017-11-23 at 15:30 -0800, Joe Perches wrote:
> --- /dev/null 2017-11-23 06:19:12.943046739 -0800
> +++ single_use_module.pl 2017-11-23 15:23:11.729812156 -0800
> @@ -0,0 +1,15 @@
[]
> +$data =~ s~$var~$string~;
this needs to be:
$data =~ s~\b$v
On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> There is no need to #define the license of the driver, just put it in
> the MODULE_LICENSE() line directly as a text string.
>
> This allows tools that check that the module license matches the source
> code license to work properly,
On Sun, 2017-12-17 at 22:00 -0700, Jason Gunthorpe wrote:
> On Sun, Dec 17, 2017 at 03:14:10AM +0100, Knut Omang wrote:
>
> > > I like the ability to add more checkers and keep then in the main
> > > upstream tree. But adding overrides for specific subsystems goes against
> > > the policy that
On Sat, 2017-12-16 at 09:47 -0800, Stephen Hemminger wrote:
> On Sat, 16 Dec 2017 15:42:25 +0100
> Knut Omang wrote:
>
> > This patch series implements features to make it easier to run checkers on
> > the
> > entire kernel as part of automatic and developer testing.
> >
On Sat, 2017-12-16 at 17:27 +0100, Knut Omang wrote:
> On Sat, 2017-12-16 at 07:21 -0800, Joe Perches wrote:
> > On Sat, 2017-12-16 at 15:42 +0100, Knut Omang wrote:
> > > This patch series implements features to make it easier to run checkers
> > > on the
> > >
On Mon, 2017-12-18 at 14:05 +0100, Knut Omang wrote:
> > Here is a list of the checkpatch messages for drivers/infiniband
> > sorted by type.
> >
> > Many of these might be corrected by using
> >
> > $ ./scripts/checkpatch.pl -f --fix-inplace --types= \
> > $(git ls-files drivers/infiniband/)
On Mon, 2017-12-18 at 10:46 -0700, Jason Gunthorpe wrote:
> On Sun, Dec 17, 2017 at 10:00:17PM -0800, Joe Perches wrote:
>
> > > Today when we run checkers we get so many warnings it is too hard to
> > > make any sense of it.
> >
> > Here is a list of
On Sat, 2017-12-16 at 15:42 +0100, Knut Omang wrote:
> This patch series implements features to make it easier to run checkers on the
> entire kernel as part of automatic and developer testing.
This seems like a useful and reasonable series, thanks.
Do please take Julia's grammar updates.
How is
On Wed, 2017-11-15 at 22:55 +0100, Julia Lawall wrote:
> What version of Coccinelle do you have?
> > I tried 1.0.4 and 1.0.6,
> > but both failed.
> For me, it also fails for 1.0.6. It should be OK for 1.0.7.
Then likely this patch should not be applied or
some form of local version checking
Many times it would be useful to update functions
where non-const arguments are used only as const
dereferences or as arguments to other function that
use const.
Is it possible for coccinelle to find and show
these types of uses that could be const?
e.g.
int foo(int val, u8 *a, int index)
{
On Mon, 2018-06-11 at 23:23 +0200, Julia Lawall wrote:
> On Mon, 11 Jun 2018, Joe Perches wrote:
> > Many times it would be useful to update functions
> > where non-const arguments are used only as const
> > dereferences or as arguments to other function that
> > use con
On Tue, 2018-06-26 at 09:16 +0800, Chengguang Xu wrote:
> sizeof() will return unsigned value so in the error check
> negative error code will be always larger than sizeof().
This looks like a general class of error in the kernel
where a signed result that could be returning a -errno
is tested
On Thu, 2018-06-21 at 15:17 +0200, Julia Lawall wrote:
> On Wed, 20 Jun 2018, Joe Perches wrote:
> > Also, spatch (1.0.4) seems to have a defect for this
> > when the type is used in operations that change a
> > smaller type to int or unsigned int.
> >
> > i.e
On Thu, 2018-08-23 at 18:13 -0400, Julia Lawall wrote:
>
> On Thu, 23 Aug 2018, Kees Cook wrote:
>
> > On Thu, Aug 23, 2018 at 3:00 PM, Julia Lawall wrote:
> > >
> > >
> > > On Thu, 23 Aug 2018, Kees Cook wrote:
> > >
> >
On Thu, 2018-08-23 at 20:17 -0400, Julia Lawall wrote:
>
> On Thu, 23 Aug 2018, Joe Perches wrote:
>
> > On Thu, 2018-08-23 at 15:27 -0700, Kees Cook wrote:
> > > On Thu, Aug 23, 2018 at 3:21 PM, Joe Perches wrote:
> > > > On Thu, 2018-08-2
On Thu, 2018-08-23 at 15:27 -0700, Kees Cook wrote:
> On Thu, Aug 23, 2018 at 3:21 PM, Joe Perches wrote:
> > On Thu, 2018-08-23 at 18:13 -0400, Julia Lawall wrote:
> > >
> > > On Thu, 23 Aug 2018, Kees Cook wrote:
> > >
> > > (a + b
On Thu, 2018-03-29 at 21:03 +0530, Varsha Rao wrote:
> On Wed, Mar 28, 2018 at 11:41 PM, Joe Perches wrote:
> >
> > On Wed, 2018-03-28 at 23:27, Varsha Rao wrote:
> > > This patch fixes the clang warning of extraneous parentheses, with the
> >
On Wed, 2018-03-28 at 23:27 +0530, Varsha Rao wrote:
> This patch fixes the clang warning of extraneous parentheses, with the
> following coccinelle script.
>
> @@
> identifier i;
> constant c;
> @@
> (
> -((i == c))
> +i == c
> >
>
> -((i <= c))
> +i <= c
Why just the "==" and "<=" cases?
Why
On Sun, 2018-03-18 at 18:50 +0100, Julia Lawall wrote:
>
> On Sun, 18 Mar 2018, Joe Perches wrote:
>
> > There are many blocks of code that could be
> > unindented and so neatened by reversing tests.
[]
> > Which often saves many vertical lines by reducing
> > n
There are many blocks of code that could be
unindented and so neatened by reversing tests.
For instance, here are linux-kernel void functions
with deep indentation at the end of the function
definition.
These functions are all similar to:
void foo(...)
{
[code...]
if (foo) {
On Wed, 2019-08-28 at 13:33 +0200, Rasmus Villemoes wrote:
> On 25/08/2019 21.19, Julia Lawall wrote:
> > > On 26 Aug 2019, at 02:59, Denis Efremov wrote:
> > > > On 25.08.2019 19:37, Joe Perches wrote:
> > > > > On Sun, 2019-08-25 at 16:05 +0300, Denis E
On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
> This patch adds coccinelle script for detecting !likely and !unlikely
> usage. It's better to use unlikely instead of !likely and vice versa.
Please explain _why_ is it better in the changelog.
btw: there are relatively few uses like this
On Mon, 2019-07-29 at 10:07 -0400, Julia Lawall wrote:
> I see that stracpy is now in linux-next. Would it be reasonable to send
> patches adding uses now?
My preference would be to have:
o A provably correct script If a small subset of
possible conversions are skipped, that's fine.
o As
like u8 or unsigned char.
A BUILD_BUG is emitted when the type of to is not compatible.
Signed-off-by: Joe Perches
---
include/linux/string.h | 41 +
1 file changed, 41 insertions(+)
diff --git a/include/linux/string.h b/include/linux/string.h
index
On Tue, 2019-07-23 at 15:52 -0500, Julia Lawall wrote:
> On Mon, 22 Jul 2019, Joe Perches wrote:
> > I just sent a patch to add yet another string copy mechanism.
> >
> > This could help avoid misuses of strscpy and strlcpy like this
> > patch set:
> >
>
On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> A seantic patch and the resulting output for the case where the third
> arugument is a constant is attached. Likewise the resulting output on a
> recent linux-next.
>
> julia
Nice. Thanks Julia
A couple issues:
There is a problem with
On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
>
> On Tue, 23 Jul 2019, Joe Perches wrote:
>
> > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > > A seantic patch and the resulting output for the case where the third
> > > arugument is
On Wed, 2019-07-24 at 10:28 +, David Laight wrote:
> From: Joe Perches
> > Sent: 24 July 2019 05:38
> > On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
> > > On Tue, 23 Jul 2019, Joe Perches wrote:
> > > > On Tue, 2019-07-23 at 22:54 -0500, Julia Law
On Wed, 2019-07-24 at 20:42 -0500, Julia Lawall wrote:
> New version. I check for non-use of the return value of strlcpy and
> address some issues that affected the matching of the case where the first
> argument involves a pointer dereference. Actually, an isomorphism now
> takes care of that
On Thu, 2019-07-25 at 08:58 -0500, Julia Lawall wrote:
> On Thu, 25 Jul 2019, Joe Perches wrote:
[]
> > Just for completeness and correctness, as I at
> > least don't find an existing use:
> >
> > Perhaps this "x =" should also include += and
On Sat, 2019-10-19 at 21:43 +0100, Marc Zyngier wrote:
> Providing Coccinelle scripts that scream about perfectly valid code is
> pointless, and the result is actively harmful.
Doubtful.
If the new code is smaller object code and correct
than the conversion is worthwhile.
fyi:
There are
On Sat, 2019-10-26 at 15:54 +0800, zhanglin wrote:
> memset() the structure ethtool_wolinfo that has padded bytes
> but the padded bytes have not been zeroed out.
[]
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
[]
> @@ -1471,11 +1471,13 @@ static int ethtool_reset(struct net_device *dev,
On Tue, 2020-04-14 at 15:37 -0400, Waiman Long wrote:
> OK, I can change it to clear the key length when the allocation failed
> which isn't likely.
Perhaps:
kfree_sensitive(op->key);
op->key = NULL;
op->keylen = 0;
but I don't know that it impacts any possible state.
On Mon, 2020-04-13 at 17:15 -0400, Waiman Long wrote:
> Since kfree_sensitive() will do an implicit memzero_explicit(), there
> is no need to call memzero_explicit() before it. Eliminate those
> memzero_explicit() and simplify the call sites.
2 bits of trivia:
> diff --git
There is a block of if tests against the same variable
in include/linux/mtd/pfow.h that likely is defective
if (prog_status & 0x3)
...
else if (prog_status & 0x2)
...
else (prog_status & 0x1)
...
If the first test is true
On Tue, 2020-03-31 at 10:50 +0200, Julia Lawall wrote:
> On Mon, 30 Mar 2020, Joe Perches wrote:
>
> > There is a block of if tests against the same variable
> > in include/linux/mtd/pfow.h that likely is defective
> >
> > if (prog_status & 0x3)
> &
On Tue, 2020-03-31 at 08:28 +0200, Markus Elfring wrote:
> > There is a block of if tests against the same variable
> > in include/linux/mtd/pfow.h that likely is defective
>
> I wonder about this interpretation.
Wonder harder.
If something is (& 3) it is also either (& 2 || & 1)
so why have
On Wed, 2020-05-06 at 16:51 +0300, Luciano Coelho wrote:
> On Tue, 2020-05-05 at 20:19 -0700, Joe Perches wrote:
> > On Wed, 2020-05-06 at 11:07 +0800, Samuel Zou wrote:
> > > This silences the following coccinelle warning:
> > >
> > > "WARNING: sum of
On Sun, 2020-08-30 at 08:57 +0200, Julia Lawall wrote:
>
> On Sat, 29 Aug 2020, Joe Perches wrote:
>
> > Is it me not understanding cocci grammar again?
>
> The problem is the loop. You are trying to change something in the body
> of a loop and the body of a for lo
id compiler warnings and as a back-door mechanism to
reproduce the old uninitialized_var macro behavior.
Signed-off-by: Joe Perches
---
scripts/checkpatch.pl | 11 +++
1 file changed, 11 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 149518d2a6a7..300b2659aab3
On Thu, 2020-09-03 at 17:14 +0200, Julia Lawall wrote:
> On Wed, 2 Sep 2020, Joe Perches wrote:
> > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote:
> > > On Wed, 2 Sep 2020, Joe Perches wrote:
> > > > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote:
>
On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote:
> On Sun, 30 Aug 2020, Joe Perches wrote:
> > On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote:
> > > Unfortunately this does not work when the declaration
> > is comma terminated and not semicolon terminated.
On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote:
>
> On Wed, 2 Sep 2020, Joe Perches wrote:
>
> > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote:
> > > On Sun, 30 Aug 2020, Joe Perches wrote:
> > > > On Sun, 2020-08-30 at 17:46 +0200, Julia L
On Thu, 2020-09-10 at 12:51 -0700, Kees Cook wrote:
> On Sat, Sep 05, 2020 at 10:58:29AM -0700, Joe Perches wrote:
> > The uninitialized_var() macro was removed recently via
> > commit 63a0895d960a ("compiler: Remove uninitialized_var() macro")
> > as it's not a part
On Wed, 2020-09-02 at 23:38 +0200, Julia Lawall wrote:
> On Wed, 2 Sep 2020, Joe Perches wrote:
> > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote:
> > > On Wed, 2 Sep 2020, Joe Perches wrote:
> > > > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote:
>
On Tue, 2020-09-01 at 12:48 +0300, Denis Efremov wrote:
> uninitialized_var() macro was removed from the sources [1] and
> other warning-silencing tricks were deprecated [2]. The purpose of this
> cocci script is to prevent new occurrences of uninitialized_var()
> open-coded variants.
> +(
> +* T
On Sat, 2020-10-17 at 20:21 +0200, Julia Lawall wrote:
> On Sat, 17 Oct 2020, Joe Perches wrote:
> > On Sat, 2020-10-17 at 09:09 -0700, t...@redhat.com wrote:
> > > From: Tom Rix
> > >
> > > This is a upcoming change to clean up a new warning treewide.
>
On Sat, 2020-10-17 at 09:09 -0700, t...@redhat.com wrote:
> From: Tom Rix
>
> This is a upcoming change to clean up a new warning treewide.
> I am wondering if the change could be one mega patch (see below) or
> normal patch per file about 100 patches or somewhere half way by collecting
> early
switch/case use of break after a return or goto is unnecessary.
There is an existing warning for these uses, so add a --fix option too.
Signed-off-by: Joe Perches
---
For today's next, this would remove ~300 instances like:
case FOO:
return bar;
break
On Sun, 2020-10-18 at 13:07 -0700, Tom Rix wrote:
> I like!
[]
> could add a '|break' here to catch the couple
[]
> break;
>
> break;
Unfortunately, checkpatch is really stupid and it
wouldn't catch those
cases as there are blank lines
between the existing consecutive break
statements.
It would
On Mon, 2020-10-19 at 05:55 -0700, Tom Rix wrote:
> On 10/18/20 1:19 PM, Joe Perches wrote:
> > On Sun, 2020-10-18 at 13:07 -0700, Tom Rix wrote:
> > > I like!
> > []
> > > could add a '|break' here to catch the couple
> > []
> > > break;
> > &
switch/case use of break after a return, goto or break is unnecessary.
There is an existing warning for the return and goto uses, so add
break and a --fix option too.
Signed-off-by: Joe Perches
---
v2: Add break to matched keyword
and change the message to show the matched keyword
On Thu, 2020-08-27 at 15:45 -0700, Joe Perches wrote:
> On Thu, 2020-08-27 at 15:20 -0700, Kees Cook wrote:
> > On Fri, Aug 28, 2020 at 12:01:34AM +0300, Denis Efremov wrote:
> > > Just FYI, I've send an addition to the device_attr_show.cocci script[1]
> > > to turn
>
On Fri, 2020-08-28 at 01:10 -0700, Joe Perches wrote:
> On Fri, 2020-08-28 at 00:58 -0700, Kees Cook wrote:
> > On Thu, Aug 27, 2020 at 09:12:06PM -0700, Joe Perches wrote:
> > > Perhaps something like the below with a sample conversion
> > > that uses single a
On Fri, 2020-08-28 at 00:58 -0700, Kees Cook wrote:
> On Thu, Aug 27, 2020 at 09:12:06PM -0700, Joe Perches wrote:
> > Perhaps something like the below with a sample conversion
> > that uses single and multiple sysfs_emit uses.
>
> On quick review, I like it. :)
>
>
On Sat, 2020-08-29 at 21:36 +0200, Julia Lawall wrote:
>
> On Wed, 12 Aug 2020, Denis Efremov wrote:
>
> > Commit 63a0895d960a ("compiler: Remove uninitialized_var() macro") and
> > commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()")
> > removed uninitialized_var() and
(forwarding on to kernel-janitors/mentees and kernelnewbies)
Just fyi for anyone that cares:
A janitorial task for someone might be to use Julia's coccinelle
script below to convert the existing instances of commas that
separate statements into semicolons.
On Fri, 2020-08-21 at 23:35 -0400, Valdis Klētnieks wrote:
> On Fri, 21 Aug 2020 18:08:08 -0700, Joe Perches said:
> > (forwarding on to kernel-janitors/mentees and kernelnewbies)
> >
> > Just fyi for anyone that cares:
> >
> > A janitorial task for someone m
On Thu, 2020-08-20 at 10:33 +0200, Julia Lawall wrote:
> On Wed, 19 Aug 2020, Joe Perches wrote:
> > On Wed, 2020-08-19 at 14:22 -0700, Joe Perches wrote:
> > > There are commas used as statement terminations that should typically
> > > have used semicolons instead. Onl
On Thu, 2020-08-20 at 19:03 +0200, Julia Lawall wrote:
> > > I have a bunch of variations of this that are more complicated than I
> > > would have expected. One shorter variant that I have is:
> > >
> > > @@
> > > expression e1,e2;
> > > statement S;
> > > @@
> > >
> > > S
> > > e1
> > > -,
On Wed, 2020-08-19 at 14:22 -0700, Joe Perches wrote:
> There are commas used as statement terminations that should typically
> have used semicolons instead. Only direct assignments or use of a single
> function or value on a single line are detected by this test.
>
> e.g.:
&g
On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote:
> On Thu, Aug 27, 2020 at 03:41:06PM +0200, Rasmus Villemoes wrote:
> > On 27/08/2020 15.18, Alex Dewar wrote:
> > > On Thu, Aug 27, 2020 at 09:15:37AM +0200, Greg Kroah-Hartman wrote:
> > > > On Thu, Aug 27, 2020 at 08:42:06AM +0200, Rasmus
On Thu, 2020-08-27 at 15:20 -0700, Kees Cook wrote:
> On Fri, Aug 28, 2020 at 12:01:34AM +0300, Denis Efremov wrote:
> > Just FYI, I've send an addition to the device_attr_show.cocci script[1] to
> > turn
> > simple cases of snprintf (e.g. "%i") to sprintf. Looks like many developers
> > would
>
On Fri, 2020-08-28 at 01:38 +0300, Denis Efremov wrote:
> > This will match it (the difference is in the ';'):
thanks.
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
On Thu, 2020-08-27 at 21:42 +0200, Julia Lawall wrote:
>
> On Thu, 27 Aug 2020, Joe Perches wrote:
>
> > On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote:
> > > On Thu, Aug 27, 2020 at 03:41:06PM +0200, Rasmus Villemoes wrote:
> > > > On 27/08/2020 15.18
On Thu, 2020-08-27 at 13:29 -0700, Joe Perches wrote:
> On Thu, 2020-08-27 at 21:42 +0200, Julia Lawall wrote:
> > On Thu, 27 Aug 2020, Joe Perches wrote:
> >
> > > On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote:
> > > > On Thu, Aug 27, 2020 at 03:4
On Thu, 2020-08-27 at 23:36 +0200, Julia Lawall wrote:
> On Fri, 28 Aug 2020, Denis Efremov wrote:
[]
> Regarding current device_attr_show.cocci implementation, it detects the
> functions
> > by declaration:
> > ssize_t any_name(struct device *dev, struct device_attribute *attr, char
> > *buf)
>
On Thu, 2020-08-27 at 22:03 +, David Laight wrote:
> From: Joe Perches
> > Sent: 27 August 2020 21:30
> ...
> > Perhaps what's necessary is to find any
> > appropriate .show function and change
> > any use of strcpy/sprintf within those
> > function to so
1 - 100 of 125 matches
Mail list logo