lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b5bdc455-c0f2-409f-85fb-046ee0406467@nvidia.com>
Date: Thu, 29 Feb 2024 10:53:28 +0000
From: Jon Hunter <jonathanh@...dia.com>
To: Akhil R <akhilrajeev@...dia.com>, ldewangan@...dia.com, vkoul@...nel.org,
 thierry.reding@...il.com, digetx@...il.com, dmaengine@...r.kernel.org,
 linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: tegra186: Fix residual calculation


On 29/02/2024 06:52, Akhil R wrote:
> The exisiting residual calculation returns an incorrect value when

s/exisiting/existing/

> bytes_xfer == bytes_req. This scenario occurs particularly with
> drivers like UART where DMA is scheduled for maximum number of bytes and
> is terminated when the bytes inflow stops. At higher baud rates, it
> could request the tx_status while there is no bytes left to transfer.
> This will lead to incorrect residual being set. Hence return residual as
> '0' when bytes transferred equals to the bytes requested.
> 
> Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
> Signed-off-by: Akhil R <akhilrajeev@...dia.com>
> ---
>   drivers/dma/tegra186-gpc-dma.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
> index 88547a23825b..3642508e88bb 100644
> --- a/drivers/dma/tegra186-gpc-dma.c
> +++ b/drivers/dma/tegra186-gpc-dma.c
> @@ -746,6 +746,9 @@ static int tegra_dma_get_residual(struct tegra_dma_channel *tdc)
>   	bytes_xfer = dma_desc->bytes_xfer +
>   		     sg_req[dma_desc->sg_idx].len - (wcount * 4);
>   
> +	if (dma_desc->bytes_req == bytes_xfer)
> +		return 0;
> +
>   	residual = dma_desc->bytes_req - (bytes_xfer % dma_desc->bytes_req);
>   
>   	return residual;


Thanks! Apart from the typo, looks good to me ...

Reviewed-by: Jon Hunter <jonathanh@...dia.com>

Jon

-- 
nvpublic

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ