Category: Coccinelle

V4L/DVB (13948): radio: Correct use after free

Author: Julia Lawall <julia@diku.dk> It is not clear how to share the unlock in the case where the structure containing the lock has to be freed. So the unlock is now duplicated, with one copy moved before the free. The unlock label furthermore is no longer useful and is thus deleted. A simplified version of …

Continue reading

drivers/dma: Correct use after free

Author: Julia Lawall <julia@diku.dk> Move the kfree after the iounmap that refers to the same structure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,e; identifier f; iterator I; statement S; @@ *kfree(x); … when != &x when != x = e when != I(x,…) …

Continue reading

drivers/isdn: eliminate duplicated test

Author: Julia Lawall <julia@diku.dk> The code checked slot_rx twice. Check slot_tx by analogy with the bank case. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression E; @@ ( *E && E | *E || E ) // Signed-off-by: Julia Lawall Cc: Karsten Keil Signed-off-by: Andrew Morton Signed-off-by: David S. …

Continue reading

drivers/dma: drop unnecesary memset

Author: Julia Lawall <julia@diku.dk> memset of 0 is not needed after kzalloc The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S; @@ x = kzalloc(…); if (x == NULL) S … when != x -memset(x,0,…);// Signed-off-by: Julia Lawall Signed-off-by: Dan Williams — drivers/dma/dw_dmac.c | 2 — 1 …

Continue reading

ALSA: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai — sound/isa/msnd/msnd_midi.c | 2 +- sound/pci/hda/patch_realtek.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)   diff –git a/sound/isa/msnd/msnd_midi.c …

Continue reading

USB: isp1362: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/usb/host/isp1362-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 4297165..5596fc1 100644 …

Continue reading

[SCSI] pm8001: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Acked-by:Jack Wang Signed-off-by: James Bottomley — drivers/scsi/pm8001/pm8001_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index …

Continue reading

drivers/gpu: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The use of the allocated memory that looks like an array is &p->relocs[0], but this should be the same as p->relocs. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Signed-off-by: Dave …

Continue reading

drivers/net/cxgb3: Use kzalloc for allocating only one thing

Author: Julia Lawall <julia@diku.dk> Use kzalloc rather than kcalloc(1,…) The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ @@ – kcalloc(1, + kzalloc( …) // Signed-off-by: Julia Lawall Acked-by: Divy Le Ray Signed-off-by: David S. Miller — drivers/net/cxgb3/cxgb3_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git …

Continue reading

[S390] drivers: Correct size given to memset

Author: Julia Lawall <julia@diku.dk> Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // Signed-off-by: Julia Lawall Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky …

Continue reading