[Beignet] [PATCH] driver: fix a potential Null reference.

Zhigang Gong zhigang.gong at intel.com
Mon Jun 16 20:18:42 PDT 2014


cl_gpgpu_flush may be called when the batch buffer has been
released. We need to check whether there is a valid buffer
before we really take the following actions.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 src/intel/intel_gpgpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/intel_gpgpu.c b/src/intel/intel_gpgpu.c
index 1da6400..6af6e40 100644
--- a/src/intel/intel_gpgpu.c
+++ b/src/intel/intel_gpgpu.c
@@ -555,6 +555,8 @@ intel_gpgpu_check_binded_buf_address(intel_gpgpu_t *gpgpu)
 static void
 intel_gpgpu_flush(intel_gpgpu_t *gpgpu)
 {
+  if (!gpgpu->batch || !gpgpu->batch->buffer)
+    return;
   intel_batchbuffer_emit_mi_flush(gpgpu->batch);
   intel_batchbuffer_flush(gpgpu->batch);
   intel_gpgpu_check_binded_buf_address(gpgpu);
-- 
1.8.3.2



More information about the Beignet mailing list