All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpu: i915: fix a missing check of get_free_page
@ 2019-03-09  4:24 Kangjie Lu
  2019-03-09  9:36 ` Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kangjie Lu @ 2019-03-09  4:24 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, Daniel Vetter, intel-gfx, dri-devel, linux-kernel

If the allocation fails, return false to avoid potential
NULL pointer dereference

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9a65341fec09..ad54fc3551df 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -227,8 +227,11 @@ static bool compress_init(struct compress *c)
 	}
 
 	c->tmp = NULL;
-	if (i915_has_memcpy_from_wc())
+	if (i915_has_memcpy_from_wc()) {
 		c->tmp = (void *)__get_free_page(GFP_ATOMIC | __GFP_NOWARN);
+		if (!c->tmp)
+			return false;
+	}
 
 	return true;
 }
-- 
2.17.1


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

end of thread, other threads:[~2019-03-12 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  4:24 [PATCH] gpu: i915: fix a missing check of get_free_page Kangjie Lu
2019-03-09  9:36 ` Chris Wilson
2019-03-12  9:32 ` ✗ Fi.CI.SPARSE: warning for " Patchwork
2019-03-12 10:26 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-12 11:51 ` ✓ Fi.CI.IGT: " Patchwork
2019-03-12 12:50 ` Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.