[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFAxtBT7z4XphADq@intel.com>
Date: Mon, 16 Jun 2025 11:01:08 -0400
From: Rodrigo Vivi <rodrigo.vivi@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Chris Wilson <chris@...is-wilson.co.uk>, Jani Nikula
<jani.nikula@...ux.intel.com>, Joonas Lahtinen
<joonas.lahtinen@...ux.intel.com>, Tvrtko Ursulin <tursulin@...ulin.net>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, "Frederic
Weisbecker" <frederic@...nel.org>, <intel-gfx@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] drm/i915/selftests: Fix error pointer vs NULL in
__mock_request_alloc()
On Fri, Jun 06, 2025 at 12:04:49PM +0300, Dan Carpenter wrote:
> The __mock_request_alloc() implements the smoketest->request_alloc()
> function pointer. It's called from __igt_breadcrumbs_smoketest().
> It's supposed to return error pointers, and returning NULL will lead to
> a NULL pointer dereference.
>
> Fixes: 52c0fdb25c7c ("drm/i915: Replace global breadcrumbs with per-context interrupt tracking")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> drivers/gpu/drm/i915/selftests/i915_request.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
> index 88870844b5bd..e349244a5fba 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_request.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_request.c
> @@ -290,7 +290,12 @@ struct smoketest {
> static struct i915_request *
> __mock_request_alloc(struct intel_context *ce)
> {
> - return mock_request(ce, 0);
> + struct i915_request *rq;
> +
> + rq = mock_request(ce, 0);
> + if (!rq)
> + return ERR_PTR(-ENOMEM);
I believe we should fix mock_request and make it to stop replacing the
error per NULL, and make the callers to check for IS_ERR instead of is not NULL.
Then don't need to make up an error here.
> + return rq;
> }
>
> static struct i915_request *
> --
> 2.47.2
>
Powered by blists - more mailing lists