Re: [PATCH] dmaengine: dw-axi-dmac: Do not dereference NULL structure

From: Vinod Koul
Date: Fri Feb 10 2023 - 01:10:10 EST


On 27-01-23, 14:36, Kees Cook wrote:
> 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;
> | ^~
>

Applied, thanks

--
~Vinod