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

From: Andy Shevchenko
Date: Mon Jan 30 2023 - 07:52:28 EST


On Mon, Jan 30, 2023 at 12:46:26PM +0200, Andy Shevchenko wrote:
> On Fri, Jan 27, 2023 at 02:36:27PM -0800, Kees Cook wrote:

...

> If you want to fix it properly, the code should be modified like
>
> status = dma_cookie_status(dchan, cookie, txstate);
> if (status == DMA_COMPLETE || !txstate) {
> if (txstate)
> goto out;
> return status;
> }
>
> ...
>
> out:
> dma_set_residue(txstate, bytes);
>
> return status;
>
> to be in accordance with the Documentation.
>
> **OR**
>
> the Documentation should be fixed to tell that if status is DMA_COMPLETE,
> residue is undefined and assumed to be 0.
>
> Vinod?

Disregard my message. The dma_cookie_status() makes sure it's 0.
Sorry for the noise.

--
With Best Regards,
Andy Shevchenko