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.carpen...@linaro.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 >