[PATCH 2/9] dma-buf: make to_dma_fence_array NULL safe

Ruhl, Michael J michael.j.ruhl at intel.com
Fri Aug 30 16:07:27 UTC 2019


>-----Original Message-----
>From: dri-devel [mailto:dri-devel-bounces at lists.freedesktop.org] On Behalf
>Of Christian König
>Sent: Monday, August 26, 2019 10:57 AM
>To: dri-devel at lists.freedesktop.org; chris at chris-wilson.co.uk;
>daniel.vetter at ffwll.ch; sumit.semwal at linaro.org; linux-
>media at vger.kernel.org; linaro-mm-sig at lists.linaro.org
>Subject: [PATCH 2/9] dma-buf: make to_dma_fence_array NULL safe
>
>A bit surprising that this wasn't already the case.
>
>Signed-off-by: Christian König <christian.koenig at amd.com>
>---
> include/linux/dma-fence-array.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/include/linux/dma-fence-array.h b/include/linux/dma-fence-
>array.h
>index 303dd712220f..f99cd7eb24e0 100644
>--- a/include/linux/dma-fence-array.h
>+++ b/include/linux/dma-fence-array.h
>@@ -68,7 +68,7 @@ static inline bool dma_fence_is_array(struct dma_fence
>*fence)
> static inline struct dma_fence_array *
> to_dma_fence_array(struct dma_fence *fence)
> {
>-	if (fence->ops != &dma_fence_array_ops)
>+	if (!fence || fence->ops != &dma_fence_array_ops)
> 		return NULL;
>
> 	return container_of(fence, struct dma_fence_array, base);

It looks like dma_fence_is_array() has the same issue.

Is it worth fixing?

Mike


>--
>2.17.1
>
>_______________________________________________
>dri-devel mailing list
>dri-devel at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list