Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-07 Thread Jonathan Cameron
On 07/05/15 08:43, Daniel Baluta wrote: > On Thu, May 7, 2015 at 1:00 AM, Fabio Estevam wrote: >> On Wed, May 6, 2015 at 6:48 PM, Alexey Khoroshilov >> wrote: >>> If prox_parse_report() fails, memory allocated for channels is not >>> deallocated, since it is still in local variable channels >>> w

Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-07 Thread Daniel Baluta
On Thu, May 7, 2015 at 1:00 AM, Fabio Estevam wrote: > On Wed, May 6, 2015 at 6:48 PM, Alexey Khoroshilov > wrote: >> If prox_parse_report() fails, memory allocated for channels is not >> deallocated, since it is still in local variable channels >> while kfree() is called with indio_dev->channels

Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-06 Thread Alexey Khoroshilov
On 07.05.2015 01:32, Fabio Estevam wrote: > On Wed, May 6, 2015 at 7:14 PM, Alexey Khoroshilov > wrote: > >> Not exactly. Other calls are after >> indio_dev->channels = channels; >> So, >> error_free_dev_mem: >> kfree(indio_dev->channels); >> works for them well. > > indio_dev is alloc

Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-06 Thread Fabio Estevam
On Wed, May 6, 2015 at 7:14 PM, Alexey Khoroshilov wrote: > Not exactly. Other calls are after > indio_dev->channels = channels; > So, > error_free_dev_mem: > kfree(indio_dev->channels); > works for them well. indio_dev is allocated using devm_ , so you don't need to free it. Your pat

Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-06 Thread Alexey Khoroshilov
On 07.05.2015 01:00, Fabio Estevam wrote: > On Wed, May 6, 2015 at 6:48 PM, Alexey Khoroshilov > wrote: >> If prox_parse_report() fails, memory allocated for channels is not >> deallocated, since it is still in local variable channels >> while kfree() is called with indio_dev->channels. >> >> Foun

Re: [PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-06 Thread Fabio Estevam
On Wed, May 6, 2015 at 6:48 PM, Alexey Khoroshilov wrote: > If prox_parse_report() fails, memory allocated for channels is not > deallocated, since it is still in local variable channels > while kfree() is called with indio_dev->channels. > > Found by Linux Driver Verification project (linuxtestin

[PATCH] iio: hid-sensors: Fix memory leak on failure path in hid_prox_probe()

2015-05-06 Thread Alexey Khoroshilov
If prox_parse_report() fails, memory allocated for channels is not deallocated, since it is still in local variable channels while kfree() is called with indio_dev->channels. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov --- drivers/iio/light/h