On 7/20/22 21:02, Alexander Atanasov wrote: > Hi, > > On 20/07/2022 20:57, Vasily Averin wrote: > >> Hi Alexander! >> >> On 7/20/22 14:05, Alexander Atanasov wrote: >>> Fix off-by-one error - tries to free the failed allocation and >>> it leaks the first successful >> Could you please elaborate? I do not see the difference in behavior. >> >> if we have failed on 2nd allocation >> we have i = 1 >> io_vec[0] was set >> io_vec[1] was failed >> we jump to err: label >> doing i-- end call put_page for io_vec[0] >> 2nd turn fails. >> So looks like all works correctly. >> With your patch situation is not changed. >> >> Am I missed something perhaps? > > > No, of course you are not. My bad i overlooked it. Please, ignore.
Do not worry, you are fine! >> >> Thank you, >> Vasily Averin >> >>> Signed-off-by: Alexander Atanasov <alexander.atana...@virtuozzo.com> >>> --- >>> drivers/md/dm-ploop-cmd.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c >>> index 429a03cce392..e4ea738828bc 100644 >>> --- a/drivers/md/dm-ploop-cmd.c >>> +++ b/drivers/md/dm-ploop-cmd.c >>> @@ -489,7 +489,7 @@ struct pio *alloc_pio_with_pages(struct ploop *ploop) >>> return pio; >>> err: >>> - while (i-- > 0) >>> + while (--i >= 0) >>> put_page(pio->bi_io_vec[i].bv_page); >>> kfree(pio); >>> return NULL; >> _______________________________________________ >> Devel mailing list >> Devel@openvz.org >> https://lists.openvz.org/mailman/listinfo/devel > _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel