From: Julia Lawall ju...@diku.dk
Taking sizeof the result of sizeof is quite strange and does not seem to be
what is wanted here.
This was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
expression E;
@@
- sizeof (
sizeof (E)
- )
@@
type T
From: Julia Lawall [EMAIL PROTECTED]
Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code
that matches its definition.
The modification was made using the following semantic patch
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@haskernel@
@@
#include linux/kernel.h
From: Julia Lawall ju...@diku.dk
kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression a,flag;
expression list args;
statement S;
@@
a =
- \(kmalloc
From: Julia Lawall ju...@diku.dk
Use set_cpus_allowed_ptr rather than set_cpus_allowed.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression E1,E2;
@@
- set_cpus_allowed(E1, cpumask_of_cpu(E2))
+ set_cpus_allowed_ptr(E1, cpumask_of(E2
The function wf_smu_remove in the file drivers/macintosh/windfarm_pm91.c
ends with the following code:
if (wf_smu_slots_fans)
kfree(wf_smu_cpu_fans);
if (wf_smu_drive_fans)
kfree(wf_smu_cpu_fans);
if (wf_smu_cpu_fans)
On Mon, 29 Mar 2010, Benjamin Herrenschmidt wrote:
On Sun, 2010-03-28 at 17:48 +0200, Julia Lawall wrote:
The function wf_smu_remove in the file drivers/macintosh/windfarm_pm91.c
ends with the following code:
if (wf_smu_slots_fans)
kfree(wf_smu_cpu_fans
From: Julia Lawall ju...@diku.dk
The conditionals were testing different values, but then all freeing the
same one, which could result in a double free.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@@
expression x,e
From: Julia Lawall ju...@diku.dk
Add an unlock before exiting the function.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@r exists@
expression E1;
identifier f;
@@
f (...) { +...
* spin_lock_irq (E1,...);
... when != E1
From: Julia Lawall ju...@diku.dk
In some error handling cases the lock is not unlocked.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@r exists@
expression E1;
identifier f;
@@
f (...) { +...
* spin_lock_irqsave (E1
From: Julia Lawall ju...@diku.dk
dlpar_free_cc_nodes frees its argument, so dlpar_online_cpu should not be
called on the same value. Skip over the call to dlpar_online_cpu by
jumping directly to out.
A simplified version of the semantic patch that finds this problem is as
follows: (http
From: Julia Lawall ju...@diku.dk
Use kstrdup when the goal of an allocation is copy a string into the
allocated region.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression from,to;
expression flag,E1,E2;
statement S;
@@
- to = kmalloc
From: Julia Lawall ju...@diku.dk
Use kstrdup when the goal of an allocation is copy a string into the
allocated region.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression from,to;
expression flag,E1,E2;
statement S;
@@
- to = kmalloc
From: Julia Lawall [EMAIL PROTECTED]
The following code appears in the function fs_init_instance in the file
drivers/net/fs_enet/fs_enet-main.c.
if (fep-ops == NULL) {
printk(KERN_ERR DRV_MODULE_NAME
: %s No matching ops found (%d).\n
From: Julia Lawall [EMAIL PROTECTED]
of_node_put is needed before discarding a value received from
of_find_node_by_type, eg in error handling code.
The semantic patch that makes the change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
struct device_node *n;
struct device_node
From: Julia Lawall [EMAIL PROTECTED]
of_node_put is needed before discarding a value received from
of_find_node_by_type, eg in error handling code.
The semantic patch that makes the change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
struct device_node *n;
struct device_node
From: Julia Lawall [EMAIL PROTECTED]
of_node_put is needed before discarding a value received from
of_find_node_by_name, eg in error handling code.
The semantic patch that makes the change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
struct device_node *n;
struct device_node
However, the error handling in that routine (smu_init) needs much more
work.
Indeed, the smu = NULL at the end of the function seems a bit brutal - a
lot of allocated data ends up not getting freed. I can try to do
something about it. Did you see something else?
julia
From: Julia Lawall [EMAIL PROTECTED]
This patch makes two changes:
* As noted by Akinobu Mita in patch
b1fceac2b9e04d278316b2faddf276015fc06e3b, alloc_bootmem never returns NULL
and always returns a zeroed region of memory. Thus the error checking code
and memset after the call to alloc_bootmem
From: Julia Lawall [EMAIL PROTECTED]
As noted by Akinobu Mita in patch b1fceac2b9e04d278316b2faddf276015fc06e3b,
alloc_bootmem and related functions never return NULL and always return a
zeroed region of memory. Thus a NULL test or memset after calls to these
functions is unnecessary.
A double
From: Julia Lawall [EMAIL PROTECTED]
It seems better to dereference master before decrementing the reference
count rather than afterwards.
The problem was found using the following semantic match:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
expression n,E;
identifier fld;
iterator
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 731150d..c266c1e 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -1954,13 +1954,14 @@ static int setup_ep0(struct udc *dev)
}
/* Called by gadget driver to
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 731150d..c266c1e 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -1954,13 +1954,14 @@ static int setup_ep0(struct udc *dev)
}
/* Called by gadget driver to
From: Julia Lawall ju...@diku.dk
for_each_node_by_name only exits when its first argument is NULL, and a
subsequent call to of_node_put on that argument is unnecessary.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
iterator name
From: Julia Lawall ju...@diku.dk
for_each_node_by_name 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/)
// smpl
@@
iterator I;
expression x,E
From: Julia Lawall ju...@diku.dk
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/)
// smpl
@@
iterator I;
expression x,E,E1
...+;
|
* return ...;
)
}
...
of_node_put(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
drivers/macintosh/via-pmu-led.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index d242976..19c3718 100644
...+;
|
* return ...;
)
}
...
of_node_put(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/platforms/maple/setup.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/maple/setup.c
b/arch/powerpc/platforms/maple/setup.c
index 3fff8d9..fe34c3d 100644
--- a/arch
...+;
|
* return ...;
)
}
...
of_node_put(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/sysdev/qe_lib/qe.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 3da8014..90020de 100644
--- a/arch/powerpc
...+;
|
* return ...;
)
}
...
of_node_put(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/platforms/powermac/pfunc_core.c |9 ++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c
b/arch/powerpc/platforms/powermac
); ... }
(
return +...x...+;
|
* return ...;
)
}
...
of_node_put(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/platforms/cell/ras.c|4 +++-
arch/powerpc/platforms/cell/spider-pic.c |4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc
...+;
|
* return ...;
)
}
)
... when != x = E1
when any
iounmap(x);
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/platforms/83xx/mpc837x_mds.c |9 ++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c
b/arch
...+;
|
* return ...;
)
}
...
(
E2 = x;
|
of_node_put(x);
)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
drivers/serial/ucc_uart.c | 67 --
1 file changed, 35 insertions(+), 32 deletions(-)
diff --git a/drivers/serial/ucc_uart.c b/drivers
!= of_node_put(x)
when != if (...) { ... of_node_put(x); ... }
(
return +...x...+;
|
* return ...;
)
}
...
(
E2 = x;
|
of_node_put(x);
)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/platforms/chrp/nvram.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff
On Tue, 31 Aug 2010, walter harms wrote:
Julia Lawall schrieb:
Add a call to of_node_put in the error handling code following a call to
of_find_node_by_path.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@r exists@
local
The file arch/powerpc/platforms/cell/celleb_scc_uhc.c contains the
following function:
static inline int uhc_clkctrl_ready(u32 val)
{
const u32 mask = SCC_UHC_USBCEN | SCC_UHC_USBCEN;
return((val mask) == mask);
}
The variable mask is a bit or of two identical constants. Later
On Wed, 1 Sep 2010, Joe Perches wrote:
On Wed, 2010-09-01 at 17:51 +0200, Julia Lawall wrote:
The file arch/powerpc/platforms/cell/celleb_scc_uhc.c contains the
following function:
static inline int uhc_clkctrl_ready(u32 val)
{
const u32 mask = SCC_UHC_USBCEN | SCC_UHC_USBCEN
://coccinelle.lip6.fr/)
// smpl
@r exists@
local idexpression x;
expression E1;
position p1,p2;
@@
x...@p1 = of_get_next_child(...);
... when != x = E1
of_node_...@p2(x)
@script:python@
p1 r.p1;
p2 r.p2;
@@
cocci.print_main(call,p1)
cocci.print_secs(get,p2)
// /smpl
Signed-off-by: Julia
\|of_node_get\)(...);
... when != of_node_put(x)
kf...@p2(x)
@script:python@
p1 r.p1;
p2 r.p2;
@@
cocci.print_main(call,p1)
cocci.print_secs(free,p2)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/kernel/irq.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
\|of_node_get\)(...);
... when != of_node_put(x)
kf...@p2(x)
@script:python@
p1 r.p1;
p2 r.p2;
@@
cocci.print_main(call,p1)
cocci.print_secs(free,p2)
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
drivers/net/fs_enet/fs_enet-main.c |3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff
is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@exists@
identifier f;
constant C;
@@
unsigned f(...)
{ +...
* return -C;
...+ }
// /smpl
Signed-off-by: Julia Lawall ju...@diku.dk
---
drivers/i2c/busses/i2c-pasemi.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers
From: Julia Lawall [EMAIL PROTECTED]
The return value of the remove function of a driver structure, and thus of
a platform_driver structure, is ultimately ignored, and is thus
unnecessary. This patch removes the return value for the remove function
stored in a platform_driver structure
From: Julia Lawall ju...@diku.dk
There is a call to local_irq_restore in the normal exit case, so it would
seem that there should be one on an error return as well.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
expression l
From: Julia Lawall ju...@diku.dk
SPIN_LOCK_UNLOCKED is deprecated. The following makes the change suggested
in Documentation/spinlocks.txt
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
declarer name DEFINE_SPINLOCK;
identifier
From: Julia Lawall ju...@diku.dk
Convert a 0 error return code to a negative one, as returned elsewhere in the
function.
A new label is also added to avoid freeing things that are known to not yet
be allocated.
A simplified version of the semantic match that finds the first problem
From: Julia Lawall julia.law...@lip6.fr
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/)
// smpl
@@
identifier ret;
expression e,e1,e2,e3,e4,x
From: Julia Lawall julia.law...@lip6.fr
If the NULL test is necessary, the initialization involving a dereference of
the tested value should be moved after the NULL test.
The sematic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
type T;
expression E
From: Julia Lawall julia.law...@lip6.fr
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
(
if@p1 (\(ret 0\|ret != 0\))
{ ... return ret; }
|
ret
From: Julia Lawall julia.law...@lip6.fr
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e);
// /smpl
Signed-off-by: Julia
From: Julia Lawall julia.law...@lip6.fr
Of_node_put supports NULL as its argument, so the initial test is not
necessary.
Suggested by Uwe Kleine-König.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e
From: Julia Lawall julia.law...@lip6.fr
Of_node_put supports NULL as its argument, so the initial test is not
necessary.
Suggested by Uwe Kleine-König.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e
From: Julia Lawall julia.law...@lip6.fr
Of_node_put supports NULL as its argument, so the initial test is not
necessary.
Suggested by Uwe Kleine-König.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e
From: Julia Lawall julia.law...@lip6.fr
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e);
// /smpl
Signed-off-by: Julia
From: Julia Lawall julia.law...@lip6.fr
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e;
@@
-if (e)
of_node_put(e);
// /smpl
Signed-off-by: Julia
From: Julia Lawall julia.law...@lip6.fr
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
(
if@p1 (\(ret 0\|ret != 0\))
{ ... return ret; }
|
ret
Wrong patch, please ignore.
julia
On Sun, 23 Nov 2014, Julia Lawall wrote:
From: Julia Lawall julia.law...@lip6.fr
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. The complete semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@@
identifier x;
local idexpression e;
From: Julia Lawall ju...@diku.dk
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. A simplified version of the semantic patch that makes this
change is as follows: (http://coccinelle.lip6.fr
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. The complete semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@@
identifier x;
local idexpression e;
From: Julia Lawall julia.law...@lip6.fr
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. A simplified version of the semantic patch that makes this
change is as follows: (http
From: Julia Lawall ju...@diku.dk
At this point, window has not been stored anywhere, so it has to be freed
before leaving the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@exists@
local idexpression x;
statement
From: Julia Lawall ju...@diku.dk
At this point, ehv_pic has been allocated but not stored anywhere, so it
should be freed before leaving the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@exists@
local
From: Julia Lawall ju...@diku.dk
The label outnodev is only used when kzalloc has not yet taken place or has
failed, so there is no need for the call for kfree under this label.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr
From: Julia Lawall ju...@diku.dk
The first change is to add an of_node_put, since codec_np has previously
been allocated. The rest of the patch reorganizes the error handling code
so the only code executed is that which is needed.
A simplified version of the semantic match that finds
From: Julia Lawall ju...@diku.dk
of_parse_phandle increments the reference count of np, so this should be
decremented before trying the next possibility.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e,e1,e2;
@@
*e
From: Julia Lawall ju...@diku.dk
np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e,e1,e2
From: Julia Lawall ju...@diku.dk
np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression e,e1,e2
On Mon, 22 Aug 2011, walter harms wrote:
Am 21.08.2011 18:10, schrieb Julia Lawall:
From: Julia Lawall ju...@diku.dk
np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.
The semantic match
On Mon, 22 Aug 2011, walter harms wrote:
Am 21.08.2011 18:10, schrieb Julia Lawall:
From: Julia Lawall ju...@diku.dk
np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.
The semantic match
On Mon, 22 Aug 2011, Timur Tabi wrote:
Julia Lawall wrote:
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 0efc04a..b33271b 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -880,10 +880,12 @@ static struct device_node *find_ssi_node(struct
These patches fix cases where the return variable is not set to an error
code in an error case.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
From: Julia Lawall julia.law...@lip6.fr
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/)
// smpl
(
if@p1 (\(ret 0\|ret != 0\))
{ ... return ret; }
|
ret@p1
From: Julia Lawall julia.law...@lip6.fr
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.
Signed-off-by: Julia
On Tue, 4 Sep 2012, Lars-Peter Clausen wrote:
On 09/04/2012 10:42 AM, Artem Bityutskiy wrote:
Aiaiai! :-) [1] [2]
I've build-tested this using aiaiai and it reports that this change breaks
the build:
dedekind@blue:~/git/maintaining$ ./verify ../l2-mtd/ mpc5121_nfc
From: Julia Lawall julia.law...@lip6.fr
The function initialize_flash_pde_data is only called four times. All four
calls are in the function rtas_flash_init, and on the failure of any of the
calls, remove_flash_pde is called on the third argument of each of the
calls. There is thus no need
From: Julia Lawall julia.law...@lip6.fr
Delete successive tests to the same location. The code tested the result
of a previous call, that itself was already tested. It is changed to test
the result of the most recent call.
A simplified version of the semantic match that finds this problem
From: Julia Lawall ju...@diku.dk
Eliminate direct accesses to the driver_data field.
cf 82ab13b26f15f49be45f15ccc96bfa0b81dfd015
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
struct device *dev;
expression E;
type T;
@@
- dev
From: Julia Lawall ju...@diku.dk
The result of container_of should not be NULL. In particular, in this case
the argument to the enclosing function has passed though INIT_WORK, which
dereferences it, implying that its container cannot be NULL.
A simplified version of the semantic patch
From: Julia Lawall ju...@diku.dk
sdhci_alloc_host returns an ERR_PTR value in an error case instead of NULL.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
@match exists@
expression x, E;
statement S1, S2;
@@
x
From: Julia Lawall ju...@diku.dk
Check that the result of kzalloc is not NULL before a dereference.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc
On Thu, 30 Jul 2009, Johannes Berg wrote:
On Thu, 2009-07-30 at 16:11 +0200, Julia Lawall wrote:
From: Julia Lawall ju...@diku.dk
Check that the result of kzalloc is not NULL before a dereference.
irq_client = kzalloc(sizeof(struct pmf_irq_client
On Fri, 31 Jul 2009, Takashi Iwai wrote:
At Thu, 30 Jul 2009 16:29:54 +0200 (CEST),
Julia Lawall wrote:
On Thu, 30 Jul 2009, Johannes Berg wrote:
On Thu, 2009-07-30 at 16:11 +0200, Julia Lawall wrote:
From: Julia Lawall ju...@diku.dk
Check that the result of kzalloc
From: Julia Lawall ju...@diku.dk
Check that the result of kzalloc is not NULL before a dereference.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc
From: Julia Lawall ju...@diku.dk
Error handling code following a kzalloc should free the allocated data.
The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l
From: Julia Lawall ju...@diku.dk
Error handling code following a kzalloc should free the allocated data.
The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l
From: Julia Lawall ju...@diku.dk
Error handling code following a kzalloc should free the allocated data.
The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l
From: Julia Lawall ju...@diku.dk
The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// smpl
@haskernel@
@@
#include linux/kernel.h
@depends
From: Julia Lawall ju...@diku.dk
As in the commit 9b4a1617772d6d5ab5eeda0cd95302fae119e359, use UPIO_MEM
rather than SERIAL_IO_MEM. Both have the same value.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@has_sc@
@@
#include linux/serial_core.h
From: Julia Lawall ju...@diku.dk
Check that the result of kmalloc/kzalloc is not NULL before dereferencing it.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc
On Fri, 7 Aug 2009, Daniel K. wrote:
Julia Lawall wrote:
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1057,6 +1057,10 @@ int fsl_rio_setup(struct of_device *dev)
law_start, law_size);
ops = kmalloc(sizeof(struct rio_ops), GFP_KERNEL
From: Julia Lawall ju...@diku.dk
Check that the result of kmalloc/kzalloc is not NULL before dereferencing it.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@@
expression *x;
identifier f;
constant char *C;
@@
x = \(kmalloc\|kcalloc\|kzalloc
Signed-off-by: Julia Lawall ju...@diku.dk
---
arch/powerpc/sysdev/fsl_rmu.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c
index 02445a5..1548578 100644
--- a/arch/powerpc/sysdev/fsl_rmu.c
+++ b/arch/powerpc/sysdev/fsl_rmu.c
From: Julia Lawall julia.law...@lip6.fr
Add missing iounmap in error handling code, in a case where the function
already preforms iounmap on some other execution path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
From: Julia Lawall julia.law...@lip6.fr
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// smpl
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
-EXPORT_SYMBOL(f);
// /smpl
Furthermore
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/)
// smpl
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
Please ignore. Wrong patch set.
On Sun, 5 Apr 2015, Julia Lawall wrote:
From: Julia Lawall julia.law...@lip6.fr
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http
From: Julia Lawall julia.law...@lip6.fr
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// smpl
(
if@p1 (\(ret 0\|ret != 0\))
{ ... return ret; }
|
ret
On Sun, 11 Oct 2015, Christophe JAILLET wrote:
> of_get_next_parent can be used to simplify the while() loop and
> avoid the need of a temp variable.
Can you do something with the loop in __of_translate_address, in
drivers/of/address.c? Is there not an iterator for this?
julia
>
>
Add NULL tests on various calls to kzalloc and devm_kzalloc.
The semantic match that finds these problems is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x,y;
identifier fld;
@@
(
x = \(vmalloc\|kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|krealloc\|
kmemdup\|kstrdup\|
Add NULL test on call to devm_kzalloc.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x;
@@
* x = devm_kzalloc(...);
... when != x == NULL
*x
//
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
sound/soc/fsl/imx-pcm
These hv_ops structures are never modified, so declare them as const. Most
were const already.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <julia.law...@lip6.fr>
---
drivers/tty/hvc/hvc_xen.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/d
1 - 100 of 175 matches
Mail list logo