已合并
[Bug]: Dereference of null pointer #63
adamyliu创建于 8月13日
[Bug]: Dereference of null pointer #63
已合并
共 1 个文件变更+2-0
| @@ -144,6 +144,8 @@ static cl_int ChooseDevice(ClContext *pCtx, cl_device_id *targetDevice, cl_uchar | |||
| 144 | break; | 144 | break; |
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | + CHECK_AND_RETURN_RET_LOG(!((cl_uint)(-1) == pCtx->idxDevices[pCtx->idxPlatforms]), CL_DEVICE_NOT_FOUND, | ||
| 148 | + "[GPU]: There is no GPU to use. exit."); | ||
| 147 | if (deviceName != nullptr) { | 149 | if (deviceName != nullptr) { |
| 148 | constexpr int deviceLength = 32; | 150 | constexpr int deviceLength = 32; |
| 149 | status = clGetDeviceInfo(pCtx->devices[pCtx->idxPlatforms][pCtx->idxDevices[pCtx->idxPlatforms]], | 151 | status = clGetDeviceInfo(pCtx->devices[pCtx->idxPlatforms][pCtx->idxDevices[pCtx->idxPlatforms]], |