P4 to Git Change 1772349 by mshivama@mshivama_tf on 2019/04/20 07:35:24

SWDEV-187020 - Basic "Hello World" Tensorflow program fails to execute on HIP/VDI/PAL/LINUX

	Make sure that the size of `dest` is big enough to hoid `src` including trailing zero byte

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_device.cpp#19 edit
Esse commit está contido em:
foreman
2019-04-21 21:50:04 -04:00
commit 02b4ec115b
+4 -2
Ver Arquivo
@@ -118,11 +118,13 @@ hipError_t hipDeviceGetName(char *name, int len, hipDevice_t device) {
const auto& info = deviceHandle->info();
const auto nameLen = ::strlen(info.boardName_);
if (nameLen > (cl_uint)len) {
// Make sure that the size of `dest` is big enough to hold `src` including
// trailing zero byte
if (nameLen > (cl_uint)(len - 1)) {
HIP_RETURN(hipErrorInvalidValue);
}
::strncpy(name, info.boardName_, nameLen);
::strncpy(name, info.boardName_, (nameLen + 1));
HIP_RETURN(hipSuccess);
}