Catégorie : Linux

ALSA: sound/isa/opti9xx/miro.c: eliminate possible double free

Author: Julia Lawall <Julia.Lawall@lip6.fr> snd_miro_probe is a static function that is only called twice in the file that defines it. At each call site, its argument is freed using snd_card_free. Thus, there is no need for snd_miro_probe to call snd_card_free on its argument on any of its error exit paths. Because snd_card_free both reads the …

Lire la suite

drivers/iio/industrialio-event.c: eliminate possible double free

Author: Julia Lawall <Julia.Lawall@lip6.fr> The function __iio_add_event_config_attrs is only called once, by the function iio_device_register_eventset. If the call fails, iio_device_register_eventset calls __iio_remove_event_config_attrs. There is thus no need for __iio_add_event_config_attrs to also call __iio_remove_event_config_attrs on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier f,free,a; parameter …

Lire la suite

powerpc/rtas_flash: Eliminate possible double free

Author: Julia Lawall <Julia.Lawall@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 for initialize_flash_pde_data to call remove_flash_pde on the same argument. …

Lire la suite

iio: at91_adc: Use devm_kcalloc to allocate arrays

Author: Lars-Peter Clausen <lars@metafoo.de> Use dev_kcalloc instead of devm_kzalloc to allocate arrays since it is semantically more appropriate. While we are at it the patch also fixes the following coccinelle warning: drivers/iio/adc/at91_adc.c:277:25-31: ERROR: application of sizeof to pointer Signed-off-by: Lars-Peter Clausen Acked-By: Maxime Ripard Signed-off-by: Jonathan Cameron — drivers/iio/adc/at91_adc.c | 16 ++++++———- 1 file changed, …

Lire la suite

dm bufio: use list_move

Author: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Use list_move() instead of list_del() + list_add(). spatch with a semantic match was used to find this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun Signed-off-by: Alasdair G Kergon — drivers/md/dm-bufio.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index cc06a1e..b9e006a 100644 — a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -441,8 …

Lire la suite

dm mpath: fix check for null mpio in end_io fn

Author: Wei Yongjun <yongjun_wei@trendmicro.com.cn> The mpio dereference should be moved below the BUG_ON NULL test in multipath_end_io(). spatch with a semantic match was used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun Signed-off-by: Alasdair G Kergon — drivers/md/dm-mpath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)   diff –git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index d778563..573bd04 100644 …

Lire la suite

ath/ath9k/ar9003_eeprom.c: Remove semicolon after if

Author: Peter Senna Tschudin <peter.senna@gmail.com> This patch remove a semicolon after if(…) that is preventing the error check to work correctly. Removing this semicolon will change the code behavior, but this is intended. The semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r1@ position p; @@ if (…);@p @script:python@ p0

i2c-smbus: Convert kzalloc to devm_kzalloc

Author: Julia Lawall <Julia.Lawall@lip6.fr> Converting kzalloc to devm_kzalloc simplifies the code and ensures that the result, alert, is freed after the irq allocated by the subsequent devm_request_irq. This in turn ensures that when an interrupt can be triggered, the alert structure is still available. The problem of a free after a devm_request_irq was found using …

Lire la suite

drivers/net/ethernet/marvell/sky2.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function sky2_probe() return 0 for success and negative value for most of its internal tests failures. There are two exceptions that are error cases going to err_out*:. For this two cases, the function abort its success execution path, but returns non negative value, making it dificult for a caller …

Lire la suite

drivers/net/ethernet/marvell/skge.c: fix error return code

Author: Peter Senna Tschudin <peter.senna@gmail.com> The function skge_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_out_led_off:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller …

Lire la suite