dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] drm/i915/selftests: fix null pointer dereference on pointer data
@ 2019-10-09 10:00 Colin King
  2019-10-09 10:15 ` Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-10-09 10:00 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	Daniel Vetter, Chris Wilson, Tvrtko Ursulin, intel-gfx,
	dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where data fails to be allocated the error exit path is
via label 'out' where data is dereferenced in a for-loop.  Fix this
by exiting via the label 'out_file' instead to avoid the null pointer
dereference.

Addresses-Coverity: ("Dereference after null check")
Fixes: 50d16d44cce4 ("drm/i915/selftests: Exercise context switching in parallel")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index fb58c0919ea1..e5c235051ae5 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -263,7 +263,7 @@ static int live_parallel_switch(void *arg)
 	if (!data) {
 		i915_gem_context_unlock_engines(ctx);
 		err = -ENOMEM;
-		goto out;
+		goto out_file;
 	}
 
 	m = 0; /* Use the first context as our template for the engines */
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH][next] drm/i915/selftests: fix null pointer dereference on pointer data
  2019-10-09 10:00 [PATCH][next] drm/i915/selftests: fix null pointer dereference on pointer data Colin King
@ 2019-10-09 10:15 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2019-10-09 10:15 UTC (permalink / raw)
  To: Colin King, Daniel Vetter, David Airlie, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, dri-devel,
	intel-gfx
  Cc: kernel-janitors, linux-kernel

Quoting Colin King (2019-10-09 11:00:24)
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the case where data fails to be allocated the error exit path is
> via label 'out' where data is dereferenced in a for-loop.  Fix this
> by exiting via the label 'out_file' instead to avoid the null pointer
> dereference.
> 
> Addresses-Coverity: ("Dereference after null check")
> Fixes: 50d16d44cce4 ("drm/i915/selftests: Exercise context switching in parallel")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

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

end of thread, other threads:[~2019-10-09 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 10:00 [PATCH][next] drm/i915/selftests: fix null pointer dereference on pointer data Colin King
2019-10-09 10:15 ` Chris Wilson

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