Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1337050
| From | Rasmus Villemoes <linux@rasmusvillemoes.dk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] nvmem: core: fix error path in nvmem_add_cells() |
| Date | 2016-02-18 06:40 +0100 |
| Message-ID | <r3ptM-Rw-9@gated-at.bofh.it> (permalink) |
| References | <r01eh-2kE-13@gated-at.bofh.it> <r37Qe-59r-29@gated-at.bofh.it> |
| Organization | D03 |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] nvmem: core: fix error path in nvmem_add_cells() Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-02-17 11:50 +0100
Re: [PATCH] nvmem: core: fix error path in nvmem_add_cells() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-18 06:40 +0100
Re: [PATCH] nvmem: core: fix error path in nvmem_add_cells() Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-02-18 10:10 +0100
csiph-web