linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: Fix address passed to dma_mapping_error() in ttm_pool_map()
@ 2021-01-11 16:40 Jeremy Cline
  2021-01-11 20:21 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Cline @ 2021-01-11 16:40 UTC (permalink / raw)
  To: Christian Koenig, Huang Rui
  Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel, Jeremy Cline

check_unmap() is producing a warning about a missing map error check.
The return value from dma_map_page() should be checked for an error, not
the caller-provided dma_addr.

Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
Signed-off-by: Jeremy Cline <jcline@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index 7b2f60616750..0aa197204b08 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -190,7 +190,7 @@ static int ttm_pool_map(struct ttm_pool *pool, unsigned int order,
 		size_t size = (1ULL << order) * PAGE_SIZE;
 
 		addr = dma_map_page(pool->dev, p, 0, size, DMA_BIDIRECTIONAL);
-		if (dma_mapping_error(pool->dev, **dma_addr))
+		if (dma_mapping_error(pool->dev, addr))
 			return -EFAULT;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/ttm: Fix address passed to dma_mapping_error() in ttm_pool_map()
  2021-01-11 16:40 [PATCH] drm/ttm: Fix address passed to dma_mapping_error() in ttm_pool_map() Jeremy Cline
@ 2021-01-11 20:21 ` Christian König
  2021-01-11 20:31   ` Jeremy Cline
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2021-01-11 20:21 UTC (permalink / raw)
  To: Jeremy Cline, Huang Rui
  Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel

Am 11.01.21 um 17:40 schrieb Jeremy Cline:
> check_unmap() is producing a warning about a missing map error check.
> The return value from dma_map_page() should be checked for an error, not
> the caller-provided dma_addr.
>
> Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
> Signed-off-by: Jeremy Cline <jcline@redhat.com>

Good catch. Reviewed and pushed to drm-misc-fixes, should be in the -rc 
by the weekend.

Thanks for the help,
Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> index 7b2f60616750..0aa197204b08 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -190,7 +190,7 @@ static int ttm_pool_map(struct ttm_pool *pool, unsigned int order,
>   		size_t size = (1ULL << order) * PAGE_SIZE;
>   
>   		addr = dma_map_page(pool->dev, p, 0, size, DMA_BIDIRECTIONAL);
> -		if (dma_mapping_error(pool->dev, **dma_addr))
> +		if (dma_mapping_error(pool->dev, addr))
>   			return -EFAULT;
>   	}
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/ttm: Fix address passed to dma_mapping_error() in ttm_pool_map()
  2021-01-11 20:21 ` Christian König
@ 2021-01-11 20:31   ` Jeremy Cline
  0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Cline @ 2021-01-11 20:31 UTC (permalink / raw)
  To: Christian König
  Cc: Huang Rui, David Airlie, Daniel Vetter, dri-devel, linux-kernel

On Mon, Jan 11, 2021 at 09:21:48PM +0100, Christian König wrote:
> Am 11.01.21 um 17:40 schrieb Jeremy Cline:
> > check_unmap() is producing a warning about a missing map error check.
> > The return value from dma_map_page() should be checked for an error, not
> > the caller-provided dma_addr.
> > 
> > Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
> > Signed-off-by: Jeremy Cline <jcline@redhat.com>
> 
> Good catch. Reviewed and pushed to drm-misc-fixes, should be in the -rc by
> the weekend.
> 

Great, many thanks!

- Jeremy


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-11 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 16:40 [PATCH] drm/ttm: Fix address passed to dma_mapping_error() in ttm_pool_map() Jeremy Cline
2021-01-11 20:21 ` Christian König
2021-01-11 20:31   ` Jeremy Cline

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).