drivers/usb/serial/opticon.c: Release resources on kmalloc failure

Author: Julia Lawall <julia@diku.dk> Several resources have been allocated before this kmalloc failure, and thus they should be released in this error handling code, as done in nearby error handling code. The semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @r exists@ local idexpression urb; statement S; position p1,p2; @@ urb = usb_alloc_urb@p1(…); … …

Continue reading

net/rfkill/core.c: Avoid leaving freed data in a list

Author: Julia Lawall <julia@diku.dk> The list_for_each_entry loop can fail, in which case the list element is not removed from the list rfkill_fds. Since this list is not accessed by the loop, the addition of &data->list into the list is just moved after the loop. The sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) …

Continue reading

x86, mce, AMD: Fix leaving freed data in a list

Author: Julia Lawall <julia@diku.dk> b may be added to a list, but is not removed before being freed in the case of an error. This is done in the corresponding deallocation function, so the code here has been changed to follow that. The sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ …

Continue reading

rtlwifi: rtl8192cu: Fix memset/memcpy using sizeof(ptr) not sizeof(*ptr)

Author: Joe Perches <joe@perches.com> Found via coccinelle script @@ type T; T* ptr; expression E1; @@ * memset(E1, 0, sizeof(ptr)); Signed-off-by: Joe Perches Signed-off-by: John W. Linville — drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 4 ++– 1 file changed, 2 insertions(+), 2 deletions(-)   diff –git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 79c98f6..3a92ba3 100644 — a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c @@ -372,7 +372,7 @@ …

Continue reading

staging: brcm80211: brcmfmac: Fix memset using sizeof(ptr) not sizeof(*ptr)

Author: Joe Perches <joe@perches.com> Found via coccinelle script @@ type T; T* ptr; expression E1; @@ * memset(E1, 0, sizeof(ptr)); Signed-off-by: Joe Perches Acked-by: Roland Vossen Signed-off-by: Greg Kroah-Hartman — drivers/staging/brcm80211/brcmfmac/wl_iw.c | 4 +— 1 file changed, 1 insertion(+), 3 deletions(-)   diff –git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c index a16b46c..4b810ed 100644 — a/drivers/staging/brcm80211/brcmfmac/wl_iw.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c @@ -498,9 …

Continue reading

[SCSI] hpsa: Change memset using sizeof(ptr) to sizeof(*ptr)

Author: Joe Perches <joe@perches.com> Not at all sure this is correct or appropriate to change, but this seems odd. Found via coccinelle script @@ type T; T* ptr; expression E1; @@ * memset(E1, 0, sizeof(ptr)); Signed-off-by: Joe Perches Acked-by: Stephen M. Cameron Signed-off-by: James Bottomley Signed-off-by: James Bottomley — drivers/scsi/hpsa.c | 2 +- 1 file …

Continue reading

drivers/tty/moxa.c: Put correct tty value

Author: Julia Lawall <julia@diku.dk> The tty value that should be put is the one that was just gotten by tty_port_tty_get, not the one that is the argument to the enclosing function. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @exists@ local idexpression struct tty_struct *x; expression ra,rr; statement S1,S2; @@ x …

Continue reading

drivers/video/s3c2410fb.c: Convert release_resource to release_mem_region

Author: Julia Lawall <julia@diku.dk> Request_mem_region should be used with release_mem_region, not release_resource. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @s exists@ expression e1,e2,e3,e4,e; @@ *e4 = request_mem_region(e1,e2,e3) … when != e4 = e *release_resource(e4); // Signed-off-by: Julia Lawall Signed-off-by: Paul Mundt — drivers/video/s3c2410fb.c | 8 +++—– 1 file changed, 3 …

Continue reading

drivers/video/sm501fb.c: Convert release_resource to release_mem_region

Author: Julia Lawall <julia@diku.dk> Request_mem_region should be used with release_mem_region, not release_resource. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @s exists@ expression e1,e2,e3,e4,e; @@ *e4 = request_mem_region(e1,e2,e3) … when != e4 = e *release_resource(e4); // Signed-off-by: Julia Lawall Signed-off-by: Paul Mundt — drivers/video/sm501fb.c | 24 ++++++++++++———— 1 file changed, 12 …

Continue reading

drivers/video: Convert release_resource to release_mem_region

Author: Julia Lawall <julia@diku.dk> Request_mem_region should be used with release_mem_region, not release_resource. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @s exists@ expression e1,e2,e3,e4,e; @@ *e4 = request_mem_region(e1,e2,e3) … when != e4 = e *release_resource(e4); // Signed-off-by: Julia Lawall Signed-off-by: Paul Mundt — drivers/video/s3c-fb.c | 6 ++—- drivers/video/sh7760fb.c | 6 ++—- …

Continue reading