lkml.org 
[lkml]   [2022]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] dmaengine: ti: Fix a potential under memory allocation issue in edma_setup_from_hw()
Date
If the 'queue_priority_mapping' is not provided, we need to allocate the
correct amount of memory. Each entry takes 2 s8, so actually less memory
than needed is allocated.

Update the size of each entry when the memory is devm_kcalloc'ed.

Fixes: 6d10c3950bf4 ("ARM: edma: Get IP configuration from HW (number of channels, tc, etc)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Note that the devm_kcalloc() in edma_xbar_event_map() looks also spurious.
However, this looks fine to me because of the 'nelm >>= 1;' before the
'for' loop.
---
drivers/dma/ti/edma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index 3ea8ef7f57df..f313e2cf542c 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -2121,7 +2121,7 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
* priority. So Q0 is the highest priority queue and the last queue has
* the lowest priority.
*/
- queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1, sizeof(s8),
+ queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1, sizeof(s8) * 2,
GFP_KERNEL);
if (!queue_priority_map)
return -ENOMEM;
--
2.34.1
\
 
 \ /
  Last update: 2022-05-21 19:27    [W:0.041 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site