dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf: Fix static checker warning
@ 2020-11-03  3:51 Jianxin Xiong
  2020-11-03  7:57 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Jianxin Xiong @ 2020-11-03  3:51 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, Jianxin Xiong, Christian Koenig

Here is the warning message:

	drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
	error: 'sg_table' dereferencing possible ERR_PTR()

Fix by adding error checking before dereferencing the pointer.

Fixes: ac80cd17a615 ("dma-buf: Clarify that dma-buf sg lists are page aligned")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
---
 drivers/dma-buf/dma-buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 556f62e..0eb80c1 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -908,7 +908,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
 	}
 
 #ifdef CONFIG_DMA_API_DEBUG
-	{
+	if (!IS_ERR(sg_table)) {
 		struct scatterlist *sg;
 		u64 addr;
 		int len;
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] dma-buf: Fix static checker warning
  2020-11-03  3:51 [PATCH] dma-buf: Fix static checker warning Jianxin Xiong
@ 2020-11-03  7:57 ` Christian König
  2020-11-03 16:34   ` Xiong, Jianxin
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2020-11-03  7:57 UTC (permalink / raw)
  To: Jianxin Xiong, dri-devel; +Cc: Daniel Vetter

Am 03.11.20 um 04:51 schrieb Jianxin Xiong:
> Here is the warning message:
>
> 	drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
> 	error: 'sg_table' dereferencing possible ERR_PTR()
>
> Fix by adding error checking before dereferencing the pointer.
>
> Fixes: ac80cd17a615 ("dma-buf: Clarify that dma-buf sg lists are page aligned")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

Do you have commit access to drm-misc-next or should I push it?

> ---
>   drivers/dma-buf/dma-buf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 556f62e..0eb80c1 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -908,7 +908,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
>   	}
>   
>   #ifdef CONFIG_DMA_API_DEBUG
> -	{
> +	if (!IS_ERR(sg_table)) {
>   		struct scatterlist *sg;
>   		u64 addr;
>   		int len;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* RE: [PATCH] dma-buf: Fix static checker warning
  2020-11-03  7:57 ` Christian König
@ 2020-11-03 16:34   ` Xiong, Jianxin
  0 siblings, 0 replies; 3+ messages in thread
From: Xiong, Jianxin @ 2020-11-03 16:34 UTC (permalink / raw)
  To: Christian König, dri-devel; +Cc: Vetter, Daniel

> -----Original Message-----
> From: Christian König <christian.koenig@amd.com>
> Sent: Monday, November 02, 2020 11:57 PM
> To: Xiong, Jianxin <jianxin.xiong@intel.com>; dri-devel@lists.freedesktop.org
> Cc: Sumit Semwal <sumit.semwal@linaro.org>; Vetter, Daniel <daniel.vetter@intel.com>
> Subject: Re: [PATCH] dma-buf: Fix static checker warning
> 
> Am 03.11.20 um 04:51 schrieb Jianxin Xiong:
> > Here is the warning message:
> >
> > 	drivers/dma-buf/dma-buf.c:917 dma_buf_map_attachment()
> > 	error: 'sg_table' dereferencing possible ERR_PTR()
> >
> > Fix by adding error checking before dereferencing the pointer.
> >
> > Fixes: ac80cd17a615 ("dma-buf: Clarify that dma-buf sg lists are page
> > aligned")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>
> 
> Do you have commit access to drm-misc-next or should I push it?

I don't have commit access.

> 
> > ---
> >   drivers/dma-buf/dma-buf.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index 556f62e..0eb80c1 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -908,7 +908,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
> >   	}
> >
> >   #ifdef CONFIG_DMA_API_DEBUG
> > -	{
> > +	if (!IS_ERR(sg_table)) {
> >   		struct scatterlist *sg;
> >   		u64 addr;
> >   		int len;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-11-03 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  3:51 [PATCH] dma-buf: Fix static checker warning Jianxin Xiong
2020-11-03  7:57 ` Christian König
2020-11-03 16:34   ` Xiong, Jianxin

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).