From: Jianxin Xiong Date: Tue, 3 Nov 2020 03:51:58 +0000 (-0800) Subject: dma-buf: Fix static checker warning X-Git-Tag: accepted/tizen/unified/20230118.172025~6402^2~28^2~1520 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00efd65a65968fddd9816315ce190c1fa3bfcd29;p=platform%2Fkernel%2Flinux-rpi.git dma-buf: Fix static checker warning 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 Signed-off-by: Jianxin Xiong Reviewed-by: Christian König Signed-off-by: Christian König Link: https://patchwork.freedesktop.org/patch/398485/ --- diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 696b4ce..e63684d 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;