Category: Coccinelle

btrfs: unify checking of IS_ERR and null

Author: David Sterba <dsterba@suse.cz> use IS_ERR_OR_NULL when possible, done by this coccinelle script: @ match @ identifier id; @@ ( – BUG_ON(IS_ERR(id) || !id); + BUG_ON(IS_ERR_OR_NULL(id)); | – IS_ERR(id) || !id + IS_ERR_OR_NULL(id) | – !id || IS_ERR(id) + IS_ERR_OR_NULL(id) ) Signed-off-by: David Sterba — fs/btrfs/acl.c | 2 +- fs/btrfs/extent_io.c | 12 ++++++—— fs/btrfs/file.c | …

Continue reading

crypto: caam – introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

drivers/video/bfin-lq035q1-fb.c: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

[SCSI] bnx2fc: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

drivers/staging/intel_sst/intel_sst_app_interface.c: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Stream_bufs is initialized at the beginning of the function, and then the #ifdef code declares a new variable with the same name and initializes that. If the if in the ifdef is taken, the then branch returns, implying that the first stream_bufs is never used and is leaked. The first initialization …

Continue reading

drivers/staging/cx25821/cx25821-video.c: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

drivers/staging/brcm80211/brcmfmac/wl_iw.c: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

sh: Fix irq cleanup fallout

Author: Thomas Gleixner <tglx@linutronix.de> I missed that coccinelle does not fix up header files by default. Reported-by: Rafael J. Wysocki Signed-off-by: Thomas Gleixner Cc: Paul Mundt Cc: — drivers/sh/intc/internals.h | 4 ++– 1 file changed, 2 insertions(+), 2 deletions(-)   diff –git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h index df36a42..5b93485 100644 — a/drivers/sh/intc/internals.h +++ b/drivers/sh/intc/internals.h @@ -86,7 +86,7 @@ …

Continue reading

x86: apb_timer: Fixup genirq fallout

Author: Thomas Gleixner <tglx@linutronix.de> The lonely user of the internal interface was not in the coccinelle script. Reported-by: Randy Dunlap Signed-off-by: Thomas Gleixner — arch/x86/kernel/apb_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 1293c70..cd1ffed 100644 — a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c @@ -316,7 +316,7 @@ static void apbt_setup_irq(struct apbt_dev …

Continue reading

FRV: Convert genirq namespace

Author: Thomas Gleixner <tglx@linutronix.de> Convert to new function names. Converted with coccinelle. Signed-off-by: Thomas Gleixner Signed-off-by: David Howells — arch/frv/kernel/irq-mb93091.c | 4 ++– arch/frv/kernel/irq-mb93093.c | 2 +- arch/frv/kernel/irq-mb93493.c | 3 ++- arch/frv/kernel/irq.c | 4 ++– 4 files changed, 7 insertions(+), 6 deletions(-)   diff –git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c index f007aaf..9afc2ea 100644 — a/arch/frv/kernel/irq-mb93091.c +++ b/arch/frv/kernel/irq-mb93091.c @@ …

Continue reading