intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length
@ 2021-07-08 12:25 Matthew Auld
  2021-07-08 12:25 ` [Intel-gfx] [PATCH i-g-t 2/3] tests/i915_query: extract query_garbage_items Matthew Auld
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthew Auld @ 2021-07-08 12:25 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx

If the regions query fails then the error will be encoded in the
item.length, while the ioctl will still return success.

Reported-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 lib/i915/intel_memory_region.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/i915/intel_memory_region.c b/lib/i915/intel_memory_region.c
index 144ae12c..e1e210f2 100644
--- a/lib/i915/intel_memory_region.c
+++ b/lib/i915/intel_memory_region.c
@@ -119,6 +119,13 @@ struct drm_i915_query_memory_regions *gem_get_query_memory_regions(int fd)
 	memset(&item, 0, sizeof(item));
 	item.query_id = DRM_I915_QUERY_MEMORY_REGIONS;
 	i915_query_items(fd, &item, 1);
+	/*
+	 * Any DRM_I915_QUERY_MEMORY_REGIONS specific errors are encoded in the
+	 * item.length, even though the ioctl might still return success.
+	 */
+	igt_assert_f(item.length > 0,
+		     "DRM_I915_QUERY_MEMORY_REGIONS failed with %d\n",
+		     item.length);
 
 	query_info = calloc(1, item.length);
 
-- 
2.26.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-26 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 12:25 [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length Matthew Auld
2021-07-08 12:25 ` [Intel-gfx] [PATCH i-g-t 2/3] tests/i915_query: extract query_garbage_items Matthew Auld
2021-07-26 10:13   ` [Intel-gfx] [igt-dev] " Ramalingam C
2021-07-08 12:25 ` [Intel-gfx] [PATCH i-g-t 3/3] tests/i915_query: add some sanity checking around regions query Matthew Auld
2021-07-26 11:48   ` [Intel-gfx] [igt-dev] " Ramalingam C
2021-07-26  9:32 ` [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length Ramalingam C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).