linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke()
@ 2021-03-08  8:59 Jia-Ju Bai
  2021-03-08  9:18 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  8:59 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
	matthew.auld, chris, lkml
  Cc: intel-gfx, dri-devel, linux-kernel, Jia-Ju Bai

When i915_random_order() returns NULL to order, no error return code of
igt_buddy_alloc_smoke() is assigned.
To fix this bug, err is assigned with -EINVAL in this case.

Fixes: 1fe3818d17c9 ("drm/i915/selftests: try to rein in alloc_smoke")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/gpu/drm/i915/selftests/i915_buddy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_buddy.c b/drivers/gpu/drm/i915/selftests/i915_buddy.c
index 632b912b0bc9..cf9b551b77e1 100644
--- a/drivers/gpu/drm/i915/selftests/i915_buddy.c
+++ b/drivers/gpu/drm/i915/selftests/i915_buddy.c
@@ -318,8 +318,10 @@ static int igt_buddy_alloc_smoke(void *arg)
 	}
 
 	order = i915_random_order(mm.max_order + 1, &prng);
-	if (!order)
+	if (!order) {
+		err = -EINVAL;
 		goto out_fini;
+	}
 
 	for (i = 0; i <= mm.max_order; ++i) {
 		struct i915_buddy_block *block;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke()
  2021-03-08  8:59 [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke() Jia-Ju Bai
@ 2021-03-08  9:18 ` Chris Wilson
  2021-03-08  9:26   ` Jia-Ju Bai
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2021-03-08  9:18 UTC (permalink / raw)
  To: Jia-Ju Bai, airlied, daniel, jani.nikula, joonas.lahtinen, lkml,
	matthew.auld, rodrigo.vivi
  Cc: intel-gfx, dri-devel, linux-kernel, Jia-Ju Bai

Quoting Jia-Ju Bai (2021-03-08 08:59:52)
> When i915_random_order() returns NULL to order, no error return code of
> igt_buddy_alloc_smoke() is assigned.
> To fix this bug, err is assigned with -EINVAL in this case.

It would not be EINVAL since that is used for a reference failure, but
in this case the idea was to return 0 as no testing was done and the
ENOMEM was raised before testing began i.e. not an internal and
unexpected driver allocation failure.
-Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke()
  2021-03-08  9:18 ` Chris Wilson
@ 2021-03-08  9:26   ` Jia-Ju Bai
  0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2021-03-08  9:26 UTC (permalink / raw)
  To: Chris Wilson, airlied, daniel, jani.nikula, joonas.lahtinen,
	lkml, matthew.auld, rodrigo.vivi
  Cc: intel-gfx, dri-devel, linux-kernel



On 2021/3/8 17:18, Chris Wilson wrote:
> Quoting Jia-Ju Bai (2021-03-08 08:59:52)
>> When i915_random_order() returns NULL to order, no error return code of
>> igt_buddy_alloc_smoke() is assigned.
>> To fix this bug, err is assigned with -EINVAL in this case.
> It would not be EINVAL since that is used for a reference failure, but
> in this case the idea was to return 0 as no testing was done and the
> ENOMEM was raised before testing began i.e. not an internal and
> unexpected driver allocation failure.
> -Chris

Okay, thanks for your reply :)


Best wishes,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-08  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  8:59 [PATCH] gpu: drm: i915: fix error return code of igt_buddy_alloc_smoke() Jia-Ju Bai
2021-03-08  9:18 ` Chris Wilson
2021-03-08  9:26   ` Jia-Ju Bai

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).