lkml.org 
[lkml]   [2016]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] nvmem: core: fix error path in nvmem_add_cells()
Date
On Wed, Feb 17 2016, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote:

>> err:
>> - while (--i)
>> + while (i--)
>> nvmem_cell_drop(cells[i]);
> No, this will not work.
>
> 3 issues,
>
> 1> If we enter this err path from nvmem_cell_info_to_nvmem_cell()
> failures, you would be accessing already freed cells[i].
>
> 2> accessing un-allocated cells[i].
>
> 3> you would be trying to drop cells which are not in the list.
>
>
> This is what you need here to fix it correctly.
>
> while (--i >= 0)
>

Sigh. http://thread.gmane.org/gmane.linux.kernel.mm/146058/focus=2149595

TL;DR: They're equivalent.

Rasmus

\
 
 \ /
  Last update: 2016-02-18 07:22    [W:0.176 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site