Skip to content

Commit be4d46e

Browse files
keesvinodkoul
authored andcommitted
dmaengine: dw-axi-dmac: Do not dereference NULL structure
If "vdesc" is NULL, it cannot be used with vd_to_axi_desc(). Leave "bytes" unchanged at 0. Seen under GCC 13 with -Warray-bounds: ../drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c: In function 'dma_chan_tx_status': ../drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c:329:46: warning: array subscript 0 is outside array bounds of 'struct virt_dma_desc[46116860184273879]' [-Warray-bounds=] 329 | bytes = vd_to_axi_desc(vdesc)->length; | ^~ Fixes: 8e55444 ("dmaengine: dw-axi-dmac: Support burst residue granularity") Cc: Eugeniy Paltsev <[email protected]> Cc: Vinod Koul <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 601bdad commit be4d46e

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,6 @@ dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
325325
len = vd_to_axi_desc(vdesc)->hw_desc[0].len;
326326
completed_length = completed_blocks * len;
327327
bytes = length - completed_length;
328-
} else {
329-
bytes = vd_to_axi_desc(vdesc)->length;
330328
}
331329

332330
spin_unlock_irqrestore(&chan->vc.lock, flags);

0 commit comments

Comments
 (0)