Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1634821
| From | "Javier González" <jg@lightnvm.io> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] lightnvm: fix bad back free on error path |
| Date | 2017-05-03 11:20 +0200 |
| Message-ID | <tCYBX-3bN-7@gated-at.bofh.it> (permalink) |
| References | <tCYBX-3bN-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Free memory correctly when an allocation fails on a loop and we free backwards previously successful allocations. Signed-off-by: Javier González <javier@cnexlabs.com> --- drivers/lightnvm/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 54a06c3a2b8c..6a4aa608ad95 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -74,7 +74,7 @@ static int nvm_reserve_luns(struct nvm_dev *dev, int lun_begin, int lun_end) return 0; err: - while (--i > lun_begin) + while (--i >= lun_begin) clear_bit(i, dev->lun_map); return -EBUSY; @@ -211,7 +211,7 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev, return tgt_dev; err_ch: - while (--i > 0) + while (--i >= 0) kfree(dev_map->chnls[i].lun_offs); kfree(luns); err_luns: -- 2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/2] lightnvm: fix bad back free on error path "Javier González" <jg@lightnvm.io> - 2017-05-03 11:20 +0200 Re: [PATCH 2/2] lightnvm: fix bad back free on error path Matias Bjørling <m@bjorling.me> - 2017-05-04 10:10 +0200 Re: [PATCH 2/2] lightnvm: fix bad back free on error path Christoph Hellwig <hch@infradead.org> - 2017-05-04 13:30 +0200
csiph-web