From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F30D3C4338F for ; Mon, 26 Jul 2021 09:30:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0E5E60243 for ; Mon, 26 Jul 2021 09:30:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B0E5E60243 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DB586E8F2; Mon, 26 Jul 2021 09:30:50 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C6386E851; Mon, 26 Jul 2021 09:30:48 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10056"; a="211913318" X-IronPort-AV: E=Sophos;i="5.84,270,1620716400"; d="scan'208";a="211913318" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2021 02:30:45 -0700 X-IronPort-AV: E=Sophos;i="5.84,270,1620716400"; d="scan'208";a="664544931" Received: from ramaling-i9x.iind.intel.com (HELO intel.com) ([10.99.66.205]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2021 02:30:44 -0700 Date: Mon, 26 Jul 2021 15:02:36 +0530 From: Ramalingam C To: Matthew Auld Message-ID: <20210726093235.GA20437@intel.com> References: <20210708122554.1874987-1-matthew.auld@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210708122554.1874987-1-matthew.auld@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 > Signed-off-by: Matthew Auld > --- > 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 > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 26 Jul 2021 15:02:36 +0530 From: Ramalingam C Message-ID: <20210726093235.GA20437@intel.com> References: <20210708122554.1874987-1-matthew.auld@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210708122554.1874987-1-matthew.auld@intel.com> Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 1/3] lib/intel_memory_region: verify item.length List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Matthew Auld Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org List-ID: 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 > Signed-off-by: Matthew Auld > --- > 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 > > 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 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev