mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
fix: add unrecoverable to avoid undefined behavior
Related-To: NEO-9038 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dcbf147a52
commit
bede264d0d
@@ -42,7 +42,9 @@ IoctlHelperPrelim20::IoctlHelperPrelim20(Drm &drmArg) : IoctlHelper(drmArg) {
|
|||||||
}
|
}
|
||||||
if (handleExecBufferInNonBlockMode) {
|
if (handleExecBufferInNonBlockMode) {
|
||||||
auto fileDescriptor = this->drm.getFileDescriptor();
|
auto fileDescriptor = this->drm.getFileDescriptor();
|
||||||
SysCalls::fcntl(fileDescriptor, F_SETFL, SysCalls::fcntl(fileDescriptor, F_GETFL) | O_NONBLOCK);
|
auto flags = SysCalls::fcntl(fileDescriptor, F_GETFL);
|
||||||
|
[[maybe_unused]] auto status = SysCalls::fcntl(fileDescriptor, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
DEBUG_BREAK_IF(status != 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,10 @@ unsigned int getProcessId() {
|
|||||||
|
|
||||||
unsigned long getNumThreads() {
|
unsigned long getNumThreads() {
|
||||||
struct stat taskStat;
|
struct stat taskStat;
|
||||||
stat("/proc/self/task", &taskStat);
|
if (stat("/proc/self/task", &taskStat) == 0) {
|
||||||
return taskStat.st_nlink - 2;
|
return taskStat.st_nlink - 2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mkdir(const std::string &path) {
|
int mkdir(const std::string &path) {
|
||||||
|
|||||||
@@ -1048,7 +1048,8 @@ Wddm &WddmMemoryManager::getWddm(uint32_t rootDeviceIndex) const {
|
|||||||
|
|
||||||
void *WddmMemoryManager::reserveCpuAddressRange(size_t size, uint32_t rootDeviceIndex) {
|
void *WddmMemoryManager::reserveCpuAddressRange(size_t size, uint32_t rootDeviceIndex) {
|
||||||
void *reservePtr = nullptr;
|
void *reservePtr = nullptr;
|
||||||
getWddm(rootDeviceIndex).reserveValidAddressRange(size, reservePtr);
|
auto ret = getWddm(rootDeviceIndex).reserveValidAddressRange(size, reservePtr);
|
||||||
|
UNRECOVERABLE_IF(!ret && reservePtr);
|
||||||
return reservePtr;
|
return reservePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2022 Intel Corporation
|
* Copyright (C) 2018-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "shared/source/utilities/directory.h"
|
#include "shared/source/utilities/directory.h"
|
||||||
|
|
||||||
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -42,6 +44,7 @@ std::vector<std::string> getFiles(const std::string &path) {
|
|||||||
|
|
||||||
void createDirectory(const std::string &path) {
|
void createDirectory(const std::string &path) {
|
||||||
const mode_t mode = 0777; // 777 in base 8
|
const mode_t mode = 0777; // 777 in base 8
|
||||||
mkdir(path.c_str(), mode);
|
[[maybe_unused]] auto status = mkdir(path.c_str(), mode);
|
||||||
|
DEBUG_BREAK_IF(status != 0);
|
||||||
}
|
}
|
||||||
}; // namespace NEO::Directory
|
}; // namespace NEO::Directory
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2022 Intel Corporation
|
* Copyright (C) 2018-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "shared/source/utilities/directory.h"
|
#include "shared/source/utilities/directory.h"
|
||||||
|
|
||||||
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
#include "shared/source/os_interface/windows/windows_wrapper.h"
|
#include "shared/source/os_interface/windows/windows_wrapper.h"
|
||||||
|
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
@@ -41,6 +42,7 @@ std::vector<std::string> getFiles(const std::string &path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void createDirectory(const std::string &path) {
|
void createDirectory(const std::string &path) {
|
||||||
_mkdir(path.c_str());
|
[[maybe_unused]] auto status = _mkdir(path.c_str());
|
||||||
|
DEBUG_BREAK_IF(status != 0);
|
||||||
}
|
}
|
||||||
}; // namespace NEO::Directory
|
}; // namespace NEO::Directory
|
||||||
|
|||||||
Reference in New Issue
Block a user