Mesa (master): i965: Check result of make_surface() for intel_miptree_create_for_bo
Kenneth Graunke
kwg at kemper.freedesktop.org
Wed Aug 2 04:28:15 UTC 2017
Module: Mesa
Branch: master
Commit: f28c2e225668ed7977b301100140f4f7e7bf55e6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f28c2e225668ed7977b301100140f4f7e7bf55e6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jul 31 10:22:44 2017 +0100
i965: Check result of make_surface() for intel_miptree_create_for_bo
Since make_surface() can fail, if the format isn't support by hw or
simlar error, we need to check the result before dereferencing it.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 628d80c0ff..daa49f9922 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -792,6 +792,8 @@ intel_miptree_create_for_bo(struct brw_context *brw,
0, 0, width, height, depth, 1, ISL_TILING_Y0_BIT,
ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
BO_ALLOC_FOR_RENDER, pitch, bo);
+ if (!mt)
+ return NULL;
brw_bo_reference(bo);
More information about the mesa-commit
mailing list