[Beignet] [PATCH] runtime: fix a potential null pointer dereference.
Zhigang Gong
zhigang.gong at intel.com
Thu Feb 5 22:27:40 PST 2015
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
More information about the Beignet
mailing list