From: Markus Elfring <Markus.Elfring@web.de>
To: dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org,
Vinod Koul <vkoul@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, cocci@inria.fr
Subject: [PATCH 3/3] dmaengine: timb_dma: One function call less in td_alloc_init_desc() after error detection
Date: Mon, 25 Dec 2023 11:22:24 +0100 [thread overview]
Message-ID: <3184e80d-9056-4a0f-b0c0-8c1fefa62196@web.de> (raw)
In-Reply-To: <ebd531dd-60e3-4ac3-821e-aa9890960283@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 25 Dec 2023 10:55:52 +0100
The kfree() function was called in one case by the
td_alloc_init_desc() function during error handling
even if the passed data structure member contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus use another label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/dma/timb_dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
index fc1f67bf9c06..831c67af0237 100644
--- a/drivers/dma/timb_dma.c
+++ b/drivers/dma/timb_dma.c
@@ -333,7 +333,7 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
td_desc->desc_list = kzalloc(td_desc->desc_list_len, GFP_KERNEL);
if (!td_desc->desc_list)
- goto err;
+ goto free_td_desc;
dma_async_tx_descriptor_init(&td_desc->txd, chan);
td_desc->txd.tx_submit = td_tx_submit;
@@ -351,4 +351,5 @@ static struct timb_dma_desc *td_alloc_init_desc(struct timb_dma_chan *td_chan)
return td_desc;
err:
kfree(td_desc->desc_list);
+free_td_desc:
kfree(td_desc);
--
2.43.0
next prev parent reply other threads:[~2023-12-25 10:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-25 10:15 [PATCH 0/3] dmaengine: timb_dma: Adjustments for td_alloc_init_desc() Markus Elfring
2023-12-25 10:18 ` [PATCH 1/3] dmaengine: timb_dma: Return directly after a failed kzalloc() in td_alloc_init_desc() Markus Elfring
2023-12-25 10:20 ` [PATCH 2/3] dmaengine: timb_dma: Improve a size determination " Markus Elfring
2023-12-25 10:22 ` Markus Elfring [this message]
2024-01-22 11:32 ` [PATCH 0/3] dmaengine: timb_dma: Adjustments for td_alloc_init_desc() Vinod Koul
2024-01-22 12:15 ` [0/3] " Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3184e80d-9056-4a0f-b0c0-8c1fefa62196@web.de \
--to=markus.elfring@web.de \
--cc=cocci@inria.fr \
--cc=dmaengine@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®