The hfi1_filter_array structure is never modified, so declare it as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
drivers/staging/rdma/hfi1/diag.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers
Move constants to the right of binary operators.
Generated by: scripts/coccinelle/misc/compare_const_fl.cocci
CC: Faisal Latif
Signed-off-by: Fengguang Wu
Signed-off-by: Julia Lawall
---
It's a minor point, but when I first looked at the code, I thought that
MIN and MAX were inverte
give a false positive when the dereference is an argument of sizeof, or
//# when the value is passed to another function that returns an error code.
///
// Confidence: Moderate
// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2.
// URL: http://coccinelle.lip6.fr/
// Options: --no-includes --include
kzalloc doesn't return ERR_PTR, so there is no need to test for it.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x,e;
@@
* x = kzalloc(...)
... when != x = e
* IS_ERR_OR_NULL(x)
//
Signed-off-by: Julia Lawall
---
dr
On Mon, 14 Dec 2015, Nicholas Mc Guire wrote:
> On Thu, Dec 10, 2015 at 11:13:38AM -0500, Mike Marciniszyn wrote:
> > From: Easwar Hariharan
> >
> > A code inspection pointed out that kmalloc_array may return NULL and
> > memset doesn't check the input pointer for NULL, resulting in a possible
This mmu_notifier_ops structure is never modified, so declare it as
const, like the other mmu_notifier_ops structures.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
The patches in this series are independent of each other.
drivers/infiniband/core/umem_odp.c |2 +-
1
mmu_notifier_ops structures are never modified, so declare them all as
const.
---
drivers/infiniband/core/umem_odp.c |2 +-
drivers/iommu/amd_iommu_v2.c |2 +-
drivers/xen/gntdev.c |2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--
To unsubscribe from this
The iser_reg_ops structures are never modified, so declare them as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
drivers/infiniband/ulp/iser/iscsi_iser.h |2 +-
drivers/infiniband/ulp/iser/iser_memory.c |4 ++--
2 files changed, 3 insertions(+), 3 deletions
The nes_cm_ops structure is never modified, so declare it as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
drivers/infiniband/hw/nes/nes_cm.c |2 +-
drivers/infiniband/hw/nes/nes_cm.h |2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a
On Wed, 16 Sep 2015, Dan Carpenter wrote:
> The cinfo struct has a hole after the last struct member so we need to
> zero it out. Otherwise we don't disclose some uninitialized stack data.
I think the "don't" wasn't intended in the second sentence?
julia
>
> Signed-off-by: Dan Carpenter
>
>
Remove unneeded NULL test.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
//
@@ expression x; @@
-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
//
Signed-off-by: Julia Lawall
---
drivers/staging/rdma/hfi1/user_sdma.c
Recent commits to kernel/git/torvalds/linux.git have made the following
functions able to tolerate NULL arguments:
kmem_cache_destroy (commit 3942d29918522)
mempool_destroy (commit 4e3ca3e033d1)
dma_pool_destroy (commit 44d7175da6ea)
These patches remove the associated NULL tests for the files th
From: Julia Lawall
Delete jump to a label on the next line, when that label is not
used elsewhere.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
//
@r@
identifier l;
@@
-if (...) goto l;
-l:
//
Signed-off-by: Julia Lawall
These patches drop gotos that jump to a label that is at the next
instruction, in the case that the label is not used elsewhere in the
function. The complete semantic patch that performs this transformation is
as follows:
//
@r@
position p;
identifier l;
@@
if (...) goto l@p;
l:
@script:ocaml
The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
... when !
amp;ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
//
In the first case, the printk is changed to use the ret value, rather
than duplicating PTR_ERR(ch->thread). This requires changing the format
from %ld to %d, to account for the type of ret.
Signed-off-by: Ju
From: Julia Lawall
The result of netdev_priv is already implicitly cast to the type of the
left side of the assignment.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
type T;
T *x;
@@
x =
- (T *)
netdev_priv(...)
//
Signed-off-by: Julia
From: Julia Lawall
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
-EXPORT_SYMBOL(f);
//
Signed-off-by: Julia Lawall
---
drivers/net
These patches remove EXPORT_SYMBOL or EXPORT_SYMBOL_GPL declarations on
static functions.
This was done using the following semantic patch:
(http://coccinelle.lip6.fr/)
//
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
-EXPORT_SYMBOL(f
On Mon, 12 Jan 2015, Dan Carpenter wrote:
> We should return -ENOMEM on allocation failure instead of success.
Probably not a big deal, but the commit message is not clear at all. From
the fix, it doesn't look like the code was returning -ENOMEM on success.
julia
> Fixes: e126ba97dba9 ('mlx5:
The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
... when !
From: Julia Lawall
Return a negative error code on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when !=
On Wed, 4 Jun 2014, Marciniszyn, Mike wrote:
> > Subject: [PATCH 9/10] IB/qib: use safer test on the result of
> > find_first_zero_bit
> >
> > From: Julia Lawall
>
> Thanks for the patch!
>
> Roland, I'm marking this as stable since a memory corru
On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall wrote:
> > OK, thanks. I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> > if (!
On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to under
On Wed, 4 Jun 2014, David Laight wrote:
> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall
> > > wrote:
> > > > Find_firs
On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vge
From: Julia Lawall
Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr
From: Julia Lawall
Set the return variable to an error code as done elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when !=
These patches fix cases where the return variable is not set to an error
code in an error case.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Julia Lawall
Set the return variable to an error code as done elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when !=
From: Julia Lawall
Set the return variable to an error code as done elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when !=
From: Julia Lawall
Delete successive tests to the same location. The code tested the result
of a previous allocation, that itself was already tested. It is changed to
test the result of the most recent allocation.
A simplified version of the semantic match that finds this problem is as
It looks like these patches were not a good idea, because in each case the
printk provides an error level, and WARN then provides another one.
Sorry for the noise.
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.or
From: Julia Lawall
Use WARN rather than printk followed by WARN_ON(1), for conciseness.
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
//
@@
expression list es;
@@
-printk(
+WARN(1,
es);
-WARN_ON(1);
//
Signed-off-by
From: Julia Lawall
Use WARN rather than printk followed by WARN_ON(1), for conciseness.
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
//
@@
expression list es;
@@
-printk(
+WARN(1,
es);
-WARN_ON(1);
//
Signed-off-by
From: Julia Lawall
Use WARN rather than printk followed by WARN_ON(1), for conciseness.
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
//
@@
expression list es;
@@
-printk(
+WARN(1,
es);
-WARN_ON(1);
//
Signed-off-by
From: Julia Lawall
Convert a 0 error return code to a negative one, as returned elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@
(
if (\(ret != 0\|ret
From: Julia Lawall
The function is called with locks held and thus should not use GFP_KERNEL.
The semantic patch that makes this report is available
in scripts/coccinelle/locks/call_kern.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by
From: Julia Lawall
Add calls to ib_umem_release, as in the other error-handling code in the
same function.
Signed-off-by: Julia Lawall
---
drivers/infiniband/hw/nes/nes_verbs.c |5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c
b
From: Julia Lawall
This code initializes ret to -ENOMEM, but actually ret is not used in the
code starting at err7, and -ENOMEM is always returned in this case, so the
initialization of ret is unnecessary.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr
From: Julia Lawall
It is not clear whether the assignment should be part of the if branch
suggested by its indentation. The patch preserves the current semantics.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@r disable braces4@
position p1,p2
From: Julia Lawall
list_for_each_entry binds its first argument to a non-null value, and thus
any null test on the value of that argument is superfluous.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
//
@@
iterator I;
expression x;
statement S,S1,S2
From: Julia Lawall
Use memdup_user when user data is immediately copied into the
allocated region.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@
- to = \(kmal...@p\|kzal...@p\)(size
From: Julia Lawall
Use kmemdup when some other buffer is immediately copied into the
allocated region.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
//
@@
expression from,to,size,flag;
statement S;
@@
- to = \(kmalloc\|kzalloc
From: Julia Lawall
The size argument to ioremap_nocache should be the size of desired
information, not the pointer to it.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@expression@
expression *x;
@@
x =
<+...
*sizeof(x)
...+>//
Signed-
On Mon, 7 Dec 2009, Tung, Chien Tin wrote:
> >> > /* Remap the PCI registers in adapter BAR0 to kernel VA space */
> >> >- mmio_regs = ioremap_nocache(pci_resource_start(pcidev, BAR_0),
> >> >sizeof(mmio_regs));
> >> >+ mmio_regs = ioremap_nocache(pci_resource_start(pcidev, BAR_0),
> >> >+
On Mon, 7 Dec 2009, Tung, Chien Tin wrote:
> Thanks for pointing out the bug.
>
> > /* Remap the PCI registers in adapter BAR0 to kernel VA space */
> >-mmio_regs = ioremap_nocache(pci_resource_start(pcidev, BAR_0),
> >sizeof(mmio_regs));
> >+mmio_regs = ioremap_nocache(pci_resourc
From: Julia Lawall
The size argument to ioremap_nocache should be the size of desired
information, not the pointer to it.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
//
@expression@
expression *x;
@@
x =
<+...
-sizeof(x)
+sizeof(*x)
...+>//
From: Julia Lawall
The definition of nes_netdev_ops has initializations of a local function
and eth_mac_addr for its ndo_set_mac_address field. This change uses only
the local function.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@r@
identifier I
51 matches
Mail list logo