[PATCH] arch/powerpc: Eliminate double sizeof

2009-02-04 Thread Julia Lawall
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

[PATCH 1/8] arch/ppc: Use FIELD_SIZEOF

2008-02-10 Thread Julia Lawall
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

[PATCH 1/6] arch/powerpc/platforms/pseries: Use kasprintf

2010-03-10 Thread Julia Lawall
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

[PATCH 5/7] arch/powerpc/kernel: Use set_cpus_allowed_ptr

2010-03-26 Thread Julia Lawall
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

question about drivers/macintosh/windfarm_pm91.c

2010-03-28 Thread Julia Lawall
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)

Re: question about drivers/macintosh/windfarm_pm91.c

2010-03-28 Thread Julia Lawall
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

[PATCH] drivers/macintosh: Correct potential double free

2010-03-29 Thread Julia Lawall
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

[PATCH 1/12] arch/powerpc/kernel: Add missing unlock

2010-03-29 Thread Julia Lawall
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

[PATCH 5/12] drivers/macintosh: Add missing unlock

2010-03-29 Thread Julia Lawall
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

[PATCH 1/3] arch/powerpc/platforms: Eliminate use after free

2010-04-02 Thread Julia Lawall
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

[PATCH 6/10] arch/powerpc/platforms/pseries: Use kstrdup

2010-05-14 Thread Julia Lawall
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

[PATCH 10/10] arch/powerpc/platforms/iseries: Use kstrdup

2010-05-14 Thread Julia Lawall
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

[PATCH 4/6] drivers/net/fs_enet: remove null pointer dereference

2008-05-12 Thread Julia Lawall
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

[PATCH 1/4] arch/powerpc: add missing of_node_put

2008-06-09 Thread Julia Lawall
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

[PATCH 2/4] drivers/macintosh/smu.c: add missing of_node_put

2008-06-09 Thread Julia Lawall
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

[PATCH 4/4] drivers/macintosh/therm_adt746x.c: add missing of_node_put

2008-06-09 Thread Julia Lawall
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

Re: [PATCH 2/4] drivers/macintosh/smu.c: add missing of_node_put

2008-06-09 Thread Julia Lawall
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

[PATCH] drivers/macintosh/smu.c: improve error handling

2008-06-23 Thread Julia Lawall
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

[PATCH 7/14] arch/powerpc: Eliminate NULL test and memset after alloc_bootmem

2008-06-24 Thread Julia Lawall
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

[PATCH] arch/powerpc/platforms/powermac/pic.c: move of_node_put

2008-09-21 Thread Julia Lawall
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

Re: [PATCH RFC] usb gadget: introduce usb_gadget_probe_driver

2010-07-30 Thread Julia Lawall
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

Re: [PATCH] usb gadget: don't save bind callback in struct usb_gadget_driver

2010-08-02 Thread Julia Lawall
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

[PATCH] arch/powerpc: Drop unnecessary of_node_put

2010-08-03 Thread Julia Lawall
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

[PATCH 4/9] arch/powerpc/platforms/powermac: Drop unnecessary null test

2010-08-03 Thread Julia Lawall
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

[PATCH 8/9] arch/powerpc/kernel: Drop unnecessary null test

2010-08-03 Thread Julia Lawall
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

[PATCH 1/7] drivers/macintosh/via-pmu-led.c: Add of_node_put to avoid memory leak

2010-08-29 Thread Julia Lawall
...+; | * 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

[PATCH 6/7] arch/powerpc/platforms/maple/setup.c: Add of_node_put to avoid memory leak

2010-08-29 Thread Julia Lawall
...+; | * 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

[PATCH 5/7] arch/powerpc/sysdev/qe_lib/qe.c: Add of_node_put to avoid memory leak

2010-08-29 Thread Julia Lawall
...+; | * 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

[PATCH 4/7] arch/powerpc/platforms/powermac/pfunc_core.c: Add of_node_put to avoid memory leak

2010-08-29 Thread Julia Lawall
...+; | * 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

[PATCH 7/7] arch/powerpc/platforms/cell: Add of_node_put to avoid memory leak

2010-08-29 Thread Julia Lawall
); ... } ( 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

[PATCH] arch/powerpc/platforms/83xx/mpc837x_mds.c: Add missing iounmap

2010-08-29 Thread Julia Lawall
...+; | * 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

[PATCH 1/4] drivers/serial/ucc_uart.c: Add of_node_put to avoid memory leak

2010-08-31 Thread Julia Lawall
...+; | * 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

[PATCH 4/4] arch/powerpc/platforms/chrp/nvram.c: Add of_node_put to avoid memory leak

2010-08-31 Thread Julia Lawall
!= 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

Re: [PATCH 1/7] drivers/macintosh/via-pmu-led.c: Add of_node_put to avoid memory leak

2010-08-31 Thread Julia Lawall
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

question about arch/powerpc/platforms/cell/celleb_scc_uhc.c

2010-09-01 Thread Julia Lawall
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

Re: question about arch/powerpc/platforms/cell/celleb_scc_uhc.c

2010-09-01 Thread Julia Lawall
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

[PATCH] arch/powerpc/platforms/52xx/efika.c: Add of_node_put to avoid memory leak

2010-09-04 Thread Julia Lawall
://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

[PATCH 2/2] arch/powerpc/kernel/irq.c: Add of_node_put to avoid memory leak

2010-09-04 Thread Julia Lawall
\|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

[PATCH 1/2] drivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak

2010-09-04 Thread Julia Lawall
\|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

[PATCH 4/8] drivers/i2c/busses/i2c-pasemi.c: Fix unsigned return type

2010-09-05 Thread Julia Lawall
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

[PATCH 21/28] drivers/char/xilinx_hwicap: Drop return value from platform_driver remove functions

2008-12-10 Thread Julia Lawall
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

[PATCH 2/2] arch/powerpc/platforms/85xx: Add local_irq_restore in error handling code

2008-12-21 Thread Julia Lawall
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

[PATCH 2/7] arch/powerpc/platforms/52xx: Use DEFINE_SPINLOCK

2008-12-25 Thread Julia Lawall
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

[PATCH 3/6] arch/powerpc/kvm/e500_tlb.c: fix error return code

2012-08-05 Thread Julia Lawall
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

[PATCH 3/5] drivers/net/ethernet/freescale/fs_enet: fix error return code

2012-08-14 Thread Julia Lawall
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

[PATCH 5/5] arch/powerpc/platforms/powernv/pci.c: Remove potential NULL dereferences

2012-08-14 Thread Julia Lawall
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

[PATCH 9/9] sound/ppc/snd_ps3.c: fix error return code

2012-08-19 Thread Julia Lawall
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

[PATCH 7/14] cpu: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
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

[PATCH 6/14] powerpc/fsl: fsl_soc: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
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

[PATCH 5/14] powerpc/mpc5xxx: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
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

[PATCH 4/14] powerpc/pseries: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
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

[PATCH 3/14] powerpc: gamecube/wii: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
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

[PATCH 7/14 v2] powerpc/4xx/cpm: delete unneeded test before of_node_put

2014-08-11 Thread Julia Lawall
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

[PATCH 9/9] sound/ppc/snd_ps3.c: fix error return code

2014-11-23 Thread Julia Lawall
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

Re: [PATCH 9/9] sound/ppc/snd_ps3.c: fix error return code

2014-11-23 Thread Julia Lawall
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

[PATCH 0/8] replace memset by memzero_explicit

2014-11-30 Thread Julia Lawall
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;

[PATCH 6/8] crypto: replace memset by memzero_explicit

2014-11-30 Thread Julia Lawall
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

[PATCH 0/8] replace memset by memzero_explicit

2014-11-30 Thread Julia Lawall
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;

[PATCH 6/8 v2] crypto: replace memset by memzero_explicit

2014-11-30 Thread Julia Lawall
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

[PATCH 6/9] arch/powerpc/platforms/pseries/iommu.c: add missing kfree

2011-08-08 Thread Julia Lawall
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

[PATCH 8/9] arch/powerpc/sysdev/ehv_pic.c: add missing kfree

2011-08-08 Thread Julia Lawall
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

[PATCH 4/4] sound/aoa/fabrics/layout.c: remove unneeded kfree

2011-08-20 Thread Julia Lawall
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

[PATCH 2/2] sound/soc/fsl/mpc8610_hpcd.c: add missing of_node_put

2011-08-20 Thread Julia Lawall
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

[PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put

2011-08-20 Thread Julia Lawall
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

[PATCH 2/2] arch/powerpc/platforms/powermac/setup.c: add missing of_node_put

2011-08-21 Thread 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 that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e,e1,e2

[PATCH 1/2] arch/powerpc/platforms/cell/iommu.c: add missing of_node_put

2011-08-21 Thread 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 that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e,e1,e2

Re: [PATCH 2/2] arch/powerpc/platforms/powermac/setup.c: add missing of_node_put

2011-08-22 Thread Julia Lawall
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

Re: [PATCH 2/2] arch/powerpc/platforms/powermac/setup.c: add missing of_node_put

2011-08-22 Thread Julia Lawall
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

Re: [PATCH] sound/soc/fsl/fsl_dma.c: add missing of_node_put

2011-08-22 Thread Julia Lawall
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

[PATCH 0/25] fix error return code

2013-12-29 Thread Julia Lawall
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

[PATCH 19/25] fix error return code

2013-12-29 Thread Julia Lawall
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

[PATCH 1/6] i2c: cpm: use devm_ functions

2012-08-25 Thread Julia Lawall
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

Re: [PATCH 4/4] drivers/mtd/nand/mpc5121_nfc.c: some devm_ cleanups

2012-09-04 Thread Julia Lawall
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

[PATCH 3/5] arch/powerpc/kernel/rtas_flash.c: eliminate possible double free

2012-10-21 Thread Julia Lawall
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

[PATCH 8/15] arch/powerpc/platforms/85xx/p1022_ds.c: adjust duplicate test

2013-01-21 Thread Julia Lawall
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

[PATCH 3/3] sound: use dev_set_drvdata

2009-05-17 Thread Julia Lawall
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

[PATCH 1/5] drivers/char/hvc_console.c: Drop unnecessary NULL test

2009-07-12 Thread Julia Lawall
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

[PATCH 8/9] drivers/mmc: correct error-handling code

2009-07-28 Thread Julia Lawall
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

[PATCH 5/5] sound/aoa: Add kmalloc NULL tests

2009-07-30 Thread Julia Lawall
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

Re: [PATCH 5/5] sound/aoa: Add kmalloc NULL tests

2009-07-30 Thread Julia Lawall
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

Re: [PATCH 5/5] sound/aoa: Add kmalloc NULL tests

2009-07-31 Thread Julia Lawall
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

Re: [PATCH 5/5] sound/aoa: Add kmalloc NULL tests

2009-07-31 Thread Julia Lawall
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

[PATCH 1/10] arch/powerpc/sysdev/qe_lib: introduce missing kfree

2009-08-01 Thread Julia Lawall
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

[PATCH 2/10] arch/powerpc: introduce missing kfree

2009-08-01 Thread Julia Lawall
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

[PATCH 2/10] arch/powerpc: introduce missing kfree

2009-08-02 Thread Julia Lawall
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

[PATCH 11/15] arch/powerpc: Use DIV_ROUND_CLOSEST

2009-08-02 Thread Julia Lawall
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

[PATCH 4/4] drivers/serial/mpc52xx_uart.c: Use UPIO_MEM rather than SERIAL_IO_MEM

2009-08-05 Thread Julia Lawall
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

[PATCH 1/3] arch/powerpc: Add kmalloc NULL tests

2009-08-06 Thread Julia Lawall
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

Re: [PATCH 1/3] arch/powerpc: Add kmalloc NULL tests

2009-08-07 Thread Julia Lawall
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

Re: [PATCH 1/3] arch/powerpc: Add kmalloc NULL tests

2009-08-07 Thread Julia Lawall
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

[PATCH 8/9] arch/powerpc/sysdev/fsl_rmu.c: introduce missing kfree

2011-12-23 Thread Julia Lawall
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

[PATCH 12/15] arch/powerpc/sysdev/fsl_pci.c: add missing iounmap

2012-01-12 Thread Julia Lawall
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

[PATCH 2/15] powerpc: don't export static symbol

2015-03-11 Thread Julia Lawall
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

[PATCH 0/15] don't export static symbol

2015-03-11 Thread Julia Lawall
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; @@

Re: [PATCH 9/9] sound/ppc/snd_ps3.c: fix error return code

2015-04-05 Thread Julia Lawall
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

[PATCH 9/9] sound/ppc/snd_ps3.c: fix error return code

2015-04-05 Thread Julia Lawall
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

Re: [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code

2015-10-11 Thread Julia Lawall
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 > >

[PATCH 0/4] add NULL test

2015-12-20 Thread Julia Lawall
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\|

[PATCH 1/4] ASoC: imx-pcm-dma: add NULL test

2015-12-20 Thread Julia Lawall
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

[PATCH] xen/hvc: constify hv_ops structures

2015-12-30 Thread Julia Lawall
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   2   >