All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length
Date: Thu,  8 Jul 2021 13:25:52 +0100	[thread overview]
Message-ID: <20210708122554.1874987-1-matthew.auld@intel.com> (raw)

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

             reply	other threads:[~2021-07-08 12:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 12:25 Matthew Auld [this message]
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-08 12:25   ` [igt-dev] " Matthew Auld
2021-07-26 11:48   ` [Intel-gfx] " Ramalingam C
2021-07-08 16:27 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/intel_memory_region: verify item.length Patchwork
2021-07-09  0:34 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-07-26  9:32 ` [Intel-gfx] [PATCH i-g-t 1/3] " Ramalingam C
2021-07-26  9:32   ` [igt-dev] " Ramalingam C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210708122554.1874987-1-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.