Re: [PATCH] drivers/hwmon/ibmaem.c: add missing kfree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Aug 2011 11:04:12 -0700, Guenter Roeck wrote:
> On Tue, 2011-08-09 at 11:10 -0400, Julia Lawall wrote:
> > From: Julia Lawall <julia@xxxxxxx>
> > 
> > rs_resp is dynamically allocated in this function, so it should be freed
> > before exiting in every case.  This collects the kfree and the return at
> > the end of the function.
> > 
> > Signed-off-by: Julia Lawall <julia@xxxxxxx>
>
> Good catch. Applied.

Real bug and good fix, however... This repeated kzalloc seems very bad
from performance and memory fragmentation perspectives. Given that
calls to aem_read_sensor() are serialized with &data->lock, it should
be possible to allocate the buffer once at initialization time and
always reuse it. I see that the buffer has variable size, but as far as
I can see the maximum is known in advance (sizeof struct
aem_read_sensor_resp + 8) so that should be a problem.

It also seems to me that the error paths in functions
aem_init_aem1_inst() and aem_init_aem2_inst() are incorrect. I'll send
two patches for testing and review shortly.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux