[PATCH] dma-buf: Fix static checker warning

Xiong, Jianxin jianxin.xiong at intel.com
Tue Nov 3 16:34:42 UTC 2020


> -----Original Message-----
> From: Christian König <christian.koenig at amd.com>
> Sent: Monday, November 02, 2020 11:57 PM
> To: Xiong, Jianxin <jianxin.xiong at intel.com>; dri-devel at lists.freedesktop.org
> Cc: Sumit Semwal <sumit.semwal at linaro.org>; Vetter, Daniel <daniel.vetter at 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 at oracle.com>
> > Signed-off-by: Jianxin Xiong <jianxin.xiong at intel.com>
> 
> Reviewed-by: Christian König <christian.koenig at 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;



More information about the dri-devel mailing list