intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length
Date: Mon, 26 Jul 2021 15:02:36 +0530	[thread overview]
Message-ID: <20210726093235.GA20437@intel.com> (raw)
In-Reply-To: <20210708122554.1874987-1-matthew.auld@intel.com>

On 2021-07-08 at 13:25:52 +0100, Matthew Auld wrote:
> 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);
LGTM.

Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
>  
>  	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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2021-07-26  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ramalingam C [this message]

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=20210726093235.GA20437@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /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 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).