[Beignet] [PATCH] runtime: fix a potential null pointer dereference.

Luo, Xionghu xionghu.luo at intel.com
Thu Feb 5 23:47:14 PST 2015


LGTM.

Luo Xionghu
Best Regards

-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Friday, February 6, 2015 2:28 PM
To: beignet at lists.freedesktop.org
Cc: Gong, Zhigang
Subject: [Beignet] [PATCH] runtime: fix a potential null pointer dereference.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 src/cl_device_id.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/cl_device_id.c b/src/cl_device_id.c index 9d83ab2..4e01c9f 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -496,13 +496,14 @@ skl_gt4_break:
       printf("cl_get_gt_device(): error, unknown device: %x\n", device_id);
   }
 
+  if (ret == NULL)
+    return NULL;
+
   if (!CompilerSupported()) {
-    if (ret != NULL) {
-      ret->compiler_available = CL_FALSE;
-      //ret->linker_available = CL_FALSE;
-      ret->profile = "EMBEDDED_PROFILE";
-      ret->profile_sz = strlen(ret->profile) + 1;
-    }
+    ret->compiler_available = CL_FALSE;
+    //ret->linker_available = CL_FALSE;
+    ret->profile = "EMBEDDED_PROFILE";
+    ret->profile_sz = strlen(ret->profile) + 1;
   }
 
 #ifdef HAS_USERPTR
--
1.8.3.2

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list