Skip to contentSkip to conversation

panfrost: Document base field location constraint in panfrost_gem_object

PATCH Superseded Boris Brezillon 1 participant 2 messages Nov 29, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Boris Brezillon

author maintainer
#0 lore raw

PATCH 1/1 panfrost: Document base field location constraint in panfrost_gem_object

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.

---
 drivers/gpu/drm/panfrost/panfrost_gem.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gem.h +4 -0
index e92ea67878ed..979dff1e7b07 100644
@@ -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;
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#1 lore raw

Wrong prefix, should be "drm/panfrost: ". I'll send a v2 (sorry for the noise).

Quoted 14 lines · On Fri, 29 Nov 2019 14:39:20 +0100 Boris Brezillon…

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.

---
 drivers/gpu/drm/panfrost/panfrost_gem.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gem.h +0 -0
index e92ea67878ed..979dff1e7b07 100644

drivers/gpu/drm/panfrost/panfrost_gem.h line 19

Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gem.h +4 -0
@@ -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;
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel