[PATCH 49/59] merde

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 27 14:19:16 UTC 2018


---
 drivers/gpu/drm/i915/i915_user_extensions.c | 49 +++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_user_extensions.c b/drivers/gpu/drm/i915/i915_user_extensions.c
index 5d90c368f185..6ff902966574 100644
--- a/drivers/gpu/drm/i915/i915_user_extensions.c
+++ b/drivers/gpu/drm/i915/i915_user_extensions.c
@@ -40,3 +40,52 @@ int i915_user_extensions(struct i915_user_extension __user *ext,
 
 	return 0;
 }
+
+#if 0
+int i915_user_extensions_or_unwind(struct i915_user_extension __user *ext,
+				   const i915_user_extension_tbl *tbl,
+				   unsigned long count,
+				   void *data)
+{
+	i915_user_extension_unwind unwind[16];
+	int depth = 0;
+	int err;
+
+	while (ext) {
+		u64 x;
+
+		if (get_user(x, &ext->name)) {
+			err = -EFAULT;
+			goto unwind;
+		}
+
+		err = -EINVAL;
+		if (x < count && tbl[x].fn) {
+			if (tbl[x].unwind && depth == ARRAY_SIZE(unwind)) {
+				err = -ELOOP;
+				goto unwind;
+			}
+			err = tbl[x].fn(ext, data);
+		}
+		if (err)
+			goto unwind;
+
+		if (tbl[x].unwind)
+			unwind[depth++] = tbl[x].unwind;
+
+		if (get_user(x, &ext->next_extension)) {
+			err = -EFAULT;
+			goto unwind;
+		}
+
+		ext = u64_to_user_ptr(x);
+	}
+
+	return 0;
+
+unwind:
+	while (depth--)
+		unwind[depth](data);
+	return err;
+}
+#endif
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list