lkml.org 
[lkml]   [2021]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] soc: qcom: aoss: Fix the out of bound usage of cooling_devs
On Mon, Jun 28, 2021 at 04:03:14PM -0700, Matthias Kaehlcke wrote:

[...]

>
>
> A few more previous lines of code for context:
>
> int count = QMP_NUM_COOLING_RESOURCES;
>
> qmp->cooling_devs = devm_kcalloc(qmp->dev, count,
> sizeof(*qmp->cooling_devs),
> GFP_KERNEL);
>
> I would suggest to initialize 'count' to 0 from the start and pass
> QMP_NUM_COOLING_RESOURCES to devm_kcalloc() rather than 'count',
> instead of resetting 'count' afterwards.

Yeah, I thought about it but the actual bug in the code is not resetting
the count value to 0. So fixing this way seems a better option.

Thanks,
Mani

\
 
 \ /
  Last update: 2021-06-29 06:27    [W:0.074 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site