diff mbox series

panfrost: Document base field location constraint in panfrost_gem_object

Message ID 20191129133920.2435561-1-boris.brezillon@collabora.com (mailing list archive)
State New, archived
Headers show
Series panfrost: Document base field location constraint in panfrost_gem_object | expand

Commit Message

Boris Brezillon Nov. 29, 2019, 1:39 p.m. UTC
I've spent hours chasing a memory corruption that was caused by
insertion of an extra field field before ->base. Let's document the
fact that base has to be the first field in panfrost_gem_object.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_gem.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Boris Brezillon Nov. 29, 2019, 1:57 p.m. UTC | #1
Wrong prefix, should be "drm/panfrost: ". I'll send a v2 (sorry for the
noise).

On Fri, 29 Nov 2019 14:39:20 +0100
Boris Brezillon <boris.brezillon@collabora.com> wrote:

> I've spent hours chasing a memory corruption that was caused by
> insertion of an extra field field before ->base. Let's document the
> fact that base has to be the first field in panfrost_gem_object.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_gem.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
> index e92ea67878ed..979dff1e7b07 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gem.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
> @@ -10,6 +10,10 @@
>  struct panfrost_mmu;
>  
>  struct panfrost_gem_object {
> +	/*
> +	 * Must be the first element because we're using some of the
> +	 * drm_gem_shmem helpers.
> +	 */
>  	struct drm_gem_shmem_object base;
>  	struct sg_table *sgts;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h
index e92ea67878ed..979dff1e7b07 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.h
@@ -10,6 +10,10 @@ 
 struct panfrost_mmu;
 
 struct panfrost_gem_object {
+	/*
+	 * Must be the first element because we're using some of the
+	 * drm_gem_shmem helpers.
+	 */
 	struct drm_gem_shmem_object base;
 	struct sg_table *sgts;