summaryrefslogtreecommitdiff
path: root/drivers/dma-buf/dma-buf.c
diff options
context:
space:
mode:
authorJianxin Xiong <jianxin.xiong@intel.com>2020-11-02 19:51:58 -0800
committerChristian König <christian.koenig@amd.com>2020-11-05 16:58:19 +0100
commit00efd65a65968fddd9816315ce190c1fa3bfcd29 (patch)
treede354dbe0db2db5108373d8fa266dba009a52337 /drivers/dma-buf/dma-buf.c
parent2b5b95b1ff3d70a95013a45e3b5b90f1daf42348 (diff)
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 <dan.carpenter@oracle.com> Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/398485/
Diffstat (limited to 'drivers/dma-buf/dma-buf.c')
-rw-r--r--drivers/dma-buf/dma-buf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 696b4ce4cfd9..e63684d4cd90 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;