Christophe JAILLET 0a46781c89 dmaengine: mcf-edma: Fix a potential un-allocated memory access
When 'mcf_edma' is allocated, some space is allocated for a
flexible array at the end of the struct. 'chans' item are allocated, that is
to say 'pdata->dma_channels'.

Then, this number of item is stored in 'mcf_edma->n_chans'.

A few lines later, if 'mcf_edma->n_chans' is 0, then a default value of 64
is set.

This ends to no space allocated by devm_kzalloc() because chans was 0, but
64 items are read and/or written in some not allocated memory.

Change the logic to define a default value before allocating the memory.

Fixes: e7a3ff92eaf1 ("dmaengine: fsl-edma: add ColdFire mcf5441x edma support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f55d914407c900828f6fad3ea5fa791a5f17b9a4.1685172449.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2023-08-07 00:01:29 +05:30
..
2023-02-24 17:18:54 -08:00
2023-05-24 12:24:32 +05:30
2023-05-03 11:11:56 -07:00
2023-07-06 09:48:31 -07:00
2022-09-29 12:24:16 +05:30
2023-02-24 17:18:54 -08:00
2023-01-16 09:26:06 +01:00
2023-02-24 17:18:54 -08:00
2023-05-03 11:11:56 -07:00
2022-07-06 10:50:43 +05:30
2023-05-24 12:24:32 +05:30
2021-12-13 13:18:48 +05:30
2023-02-24 17:18:54 -08:00