* [PATCH] dmaengine: dmatest: fix a small memory leak in dmatest_func()
@ 2018-12-03 14:49 Dan Carpenter
2018-12-05 8:08 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-12-03 14:49 UTC (permalink / raw)
To: Vinod Koul, Alexandru Ardelean
Cc: Vinod Koul, dmaengine, linux-kernel, kernel-janitors
We recently moved the test size tests around but it means we need to
adjust the error handling as well or we leak the "pq_coefs" memory. I
updated the label name to reflect that we're freeing coefs.
Fixes: 787d3083caf8 ("dmaengine: dmatest: move size checks earlier in function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/dma/dmatest.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index e71aa1e3451c..28deaa084257 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -511,18 +511,18 @@ static int dmatest_func(void *data)
if ((src_cnt + dst_cnt) >= 255) {
pr_err("too many buffers (%d of 255 supported)\n",
src_cnt + dst_cnt);
- goto err_thread_type;
+ goto err_free_coefs;
}
if (1 << align > params->buf_size) {
pr_err("%u-byte buffer too small for %d-byte alignment\n",
params->buf_size, 1 << align);
- goto err_thread_type;
+ goto err_free_coefs;
}
thread->srcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
if (!thread->srcs)
- goto err_srcs;
+ goto err_free_coefs;
thread->usrcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
if (!thread->usrcs)
@@ -800,7 +800,7 @@ static int dmatest_func(void *data)
kfree(thread->usrcs);
err_usrcs:
kfree(thread->srcs);
-err_srcs:
+err_free_coefs:
kfree(pq_coefs);
err_thread_type:
pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n",
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dmaengine: dmatest: fix a small memory leak in dmatest_func()
2018-12-03 14:49 [PATCH] dmaengine: dmatest: fix a small memory leak in dmatest_func() Dan Carpenter
@ 2018-12-05 8:08 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2018-12-05 8:08 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexandru Ardelean, dmaengine, linux-kernel, kernel-janitors
On 03-12-18, 17:49, Dan Carpenter wrote:
> We recently moved the test size tests around but it means we need to
> adjust the error handling as well or we leak the "pq_coefs" memory. I
> updated the label name to reflect that we're freeing coefs.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-05 8:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 14:49 [PATCH] dmaengine: dmatest: fix a small memory leak in dmatest_func() Dan Carpenter
2018-12-05 8:08 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).