]> www.infradead.org Git - users/dwmw2/linux.git/commit
dmaengine: stm32-dma3: Set lli_size after allocation
authorKees Cook <kees@kernel.org>
Tue, 16 Jul 2024 21:38:33 +0000 (14:38 -0700)
committerVinod Koul <vkoul@kernel.org>
Mon, 5 Aug 2024 16:58:48 +0000 (22:28 +0530)
commitb53b831919a0dc4e6631ebe0497ab2a4d8bef014
tree2679a74d201263b450a81beeb98aa15915409037
parent5e5c793c7fc47219998465361d94510fdf55d83f
dmaengine: stm32-dma3: Set lli_size after allocation

With the new __counted_by annotation, the "lli_size" variable needs to
valid for accesses to the "lli" array. This requirement is not met in
stm32_dma3_chan_desc_alloc(), since "lli_size" starts at "0", so "lli"
index "0" will not be considered valid during the initialization for loop.

Fix this by setting lli_size immediately after allocation (similar to
how this is handled in stm32_mdma_alloc_desc() for the node/count
relationship).

Fixes: f561ec8b2b33 ("dmaengine: Add STM32 DMA3 support")
Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20240716213830.work.951-kees@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/stm32/stm32-dma3.c